Skip to content

Commit 6f705e9

Browse files
authored
Merge pull request #663 from multiplex55/codex/update-suggestion-handling-with-dashboard-check
Suppress autocomplete suggestions when dashboard is visible
2 parents 1542a3a + 7d0acf4 commit 6f705e9

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/gui/mod.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ impl LauncherApp {
482482
fn update_suggestions(&mut self) {
483483
self.autocomplete_index = 0;
484484
self.suggestions.clear();
485-
if !self.query_autocomplete || self.query.is_empty() {
485+
if !self.query_autocomplete
486+
|| self.query.is_empty()
487+
|| self.should_show_dashboard(self.query.as_str())
488+
{
486489
return;
487490
}
488491
if let Some(ref index) = self.completion_index {
@@ -1089,6 +1092,8 @@ impl LauncherApp {
10891092
trimmed.starts_with("timer list") || trimmed.starts_with("alarm list");
10901093
self.last_stopwatch_query = trimmed.starts_with("sw list");
10911094
if trimmed.is_empty() {
1095+
self.autocomplete_index = 0;
1096+
self.suggestions.clear();
10921097
let mut res = self.command_cache.clone();
10931098
for a in self.actions.iter() {
10941099
res.push(Action {
@@ -2672,6 +2677,7 @@ impl eframe::App for LauncherApp {
26722677
}
26732678

26742679
let trimmed = self.query.trim().to_string();
2680+
let use_dashboard = self.should_show_dashboard(trimmed.as_str());
26752681
self.maybe_refresh_timer_list();
26762682
self.maybe_refresh_stopwatch_list();
26772683
if trimmed.eq_ignore_ascii_case("net")
@@ -2726,7 +2732,7 @@ impl eframe::App for LauncherApp {
27262732
self.search();
27272733
}
27282734

2729-
if self.query_autocomplete && !self.suggestions.is_empty() {
2735+
if self.query_autocomplete && !use_dashboard && !self.suggestions.is_empty() {
27302736
ui.vertical(|ui| {
27312737
for s in &self.suggestions {
27322738
ui.colored_label(Color32::GRAY, s);
@@ -2809,8 +2815,11 @@ impl eframe::App for LauncherApp {
28092815
}
28102816
});
28112817

2812-
let use_dashboard = self.should_show_dashboard(&trimmed);
28132818
if use_dashboard {
2819+
if !self.suggestions.is_empty() {
2820+
self.autocomplete_index = 0;
2821+
self.suggestions.clear();
2822+
}
28142823
let dash_ctx = DashboardContext {
28152824
actions: &self.actions,
28162825
actions_by_id: &self.actions_by_id,

0 commit comments

Comments
 (0)