Rename selected_theme to manually_selected

for consistency with outline and project_symbols
This commit is contained in:
Hendrik Sollich 2025-08-01 20:29:00 +02:00
parent b21baf41fe
commit a8b83985ab

View file

@ -113,7 +113,7 @@ struct ThemeSelectorDelegate {
matches: Vec<StringMatch>, matches: Vec<StringMatch>,
original_theme: Arc<Theme>, original_theme: Arc<Theme>,
selection_completed: bool, selection_completed: bool,
selected_theme: Option<Arc<Theme>>, manually_selected: Option<Arc<Theme>>,
selected_index: usize, selected_index: usize,
selector: WeakEntity<ThemeSelector>, selector: WeakEntity<ThemeSelector>,
} }
@ -162,7 +162,7 @@ impl ThemeSelectorDelegate {
original_theme: original_theme.clone(), original_theme: original_theme.clone(),
selected_index: 0, selected_index: 0,
selection_completed: false, selection_completed: false,
selected_theme: None, manually_selected: None,
selector, selector,
}; };
@ -268,7 +268,7 @@ impl PickerDelegate for ThemeSelectorDelegate {
cx: &mut Context<Picker<ThemeSelectorDelegate>>, cx: &mut Context<Picker<ThemeSelectorDelegate>>,
) { ) {
self.selected_index = ix; self.selected_index = ix;
self.selected_theme = self.show_selected_theme(cx); self.manually_selected = self.show_selected_theme(cx);
} }
fn update_matches( fn update_matches(
@ -312,12 +312,12 @@ impl PickerDelegate for ThemeSelectorDelegate {
this.update(cx, |this, cx| { this.update(cx, |this, cx| {
this.delegate.matches = matches; this.delegate.matches = matches;
if query.is_empty() && this.delegate.selected_theme.is_none() { if query.is_empty() && this.delegate.manually_selected.is_none() {
this.delegate.selected_index = this this.delegate.selected_index = this
.delegate .delegate
.selected_index .selected_index
.min(this.delegate.matches.len().saturating_sub(1)); .min(this.delegate.matches.len().saturating_sub(1));
} else if let Some(selected) = this.delegate.selected_theme.as_ref() { } else if let Some(selected) = this.delegate.manually_selected.as_ref() {
this.delegate.selected_index = this this.delegate.selected_index = this
.delegate .delegate
.matches .matches
@ -329,7 +329,7 @@ impl PickerDelegate for ThemeSelectorDelegate {
} else { } else {
this.delegate.selected_index = 0; this.delegate.selected_index = 0;
} }
this.delegate.selected_theme = this.delegate.show_selected_theme(cx); this.delegate.manually_selected = this.delegate.show_selected_theme(cx);
}) })
.log_err(); .log_err();
}) })