From ba568667d71bc8ecca756a6b7c96676d5aa92848 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 14 Feb 2026 10:19:08 +0200 Subject: [PATCH 1/3] Revert "chore: remove no-longer needed search_on_input=false toggle before tests (#49161)" This reverts commit 3023cf3e28cfb055f82bb912f41de470b2d1753a. --- crates/search/src/project_search.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 4587f0837056dd..81ad9ac3b41bae 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -2576,7 +2576,8 @@ pub mod tests { use project::FakeFs; use serde_json::json; use settings::{ - InlayHintSettingsContent, SettingsStore, ThemeColorsContent, ThemeStyleContent, + InlayHintSettingsContent, SearchSettingsContent, SettingsStore, ThemeColorsContent, + ThemeStyleContent, }; use util::{path, paths::PathStyle, rel_path::rel_path}; use util_macros::perf; @@ -4795,6 +4796,15 @@ pub mod tests { let settings = SettingsStore::test(cx); cx.set_global(settings); + SettingsStore::update_global(cx, |store, cx| { + store.update_user_settings(cx, |settings| { + settings.editor.search = Some(SearchSettingsContent { + search_on_input: Some(false), + ..Default::default() + }); + }); + }); + theme::init(theme::LoadThemes::JustBase, cx); editor::init(cx); From a12f2b314aa212e755deff8244ea72441e7b8a94 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 14 Feb 2026 10:19:27 +0200 Subject: [PATCH 2/3] Revert "Fix search on input behavior (#49150)" This reverts commit a0eb63d1affb6e7b7991e477c7e05824d0250255. --- assets/settings/default.json | 7 ++----- crates/editor/src/editor_settings.rs | 6 +----- crates/search/src/buffer_search.rs | 8 -------- crates/search/src/project_search.rs | 26 ++++++-------------------- crates/settings_content/src/editor.rs | 8 +------- crates/settings_ui/src/page_data.rs | 27 ++------------------------- docs/src/reference/all-settings.md | 12 +++--------- 7 files changed, 15 insertions(+), 79 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index c3ffa8c0410b48..111b42cdcc561a 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -667,11 +667,8 @@ "regex": false, // Whether to center the cursor on each search match when navigating. "center_on_match": false, - // Whether to search on input in project search. - "search_on_input": false, - // Debounce time in milliseconds for search on input in project search. - // Set to 0 to disable debouncing. - "search_on_input_debounce_ms": 200, + // Whether to search on input. + "search_on_input": true, }, // When to populate a new search's query based on the text under the cursor. // This setting can take the following three values: diff --git a/crates/editor/src/editor_settings.rs b/crates/editor/src/editor_settings.rs index 97df9fdfcd5c77..654a541a699b62 100644 --- a/crates/editor/src/editor_settings.rs +++ b/crates/editor/src/editor_settings.rs @@ -175,11 +175,8 @@ pub struct SearchSettings { pub regex: bool, /// Whether to center the cursor on each search match when navigating. pub center_on_match: bool, - /// Whether to search on input in project search. + /// Whether to search on input. pub search_on_input: bool, - /// Debounce time in milliseconds for search on input in project search. - /// Set to 0 to disable debouncing. - pub search_on_input_debounce_ms: u64, } impl EditorSettings { @@ -277,7 +274,6 @@ impl Settings for EditorSettings { regex: search.regex.unwrap(), center_on_match: search.center_on_match.unwrap(), search_on_input: search.search_on_input.unwrap(), - search_on_input_debounce_ms: search.search_on_input_debounce_ms.unwrap(), }, auto_signature_help: editor.auto_signature_help.unwrap(), show_signature_help_after_edits: editor.show_signature_help_after_edits.unwrap(), diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index e9c9725b53e29a..a8639b70cd75ca 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -3422,7 +3422,6 @@ mod tests { regex: false, center_on_match: false, search_on_input: false, - search_on_input_debounce_ms: 0, }, cx, ); @@ -3487,7 +3486,6 @@ mod tests { regex: false, center_on_match: false, search_on_input: false, - search_on_input_debounce_ms: 0, }, cx, ); @@ -3527,7 +3525,6 @@ mod tests { regex: false, center_on_match: false, search_on_input: false, - search_on_input_debounce_ms: 0, }, cx, ); @@ -3611,9 +3608,6 @@ mod tests { regex: Some(search_settings.regex), center_on_match: Some(search_settings.center_on_match), search_on_input: Some(search_settings.search_on_input), - search_on_input_debounce_ms: Some( - search_settings.search_on_input_debounce_ms, - ), }); }); }); @@ -3632,7 +3626,6 @@ mod tests { regex: false, center_on_match: false, search_on_input: false, - search_on_input_debounce_ms: 0, }, cx, ); @@ -3669,7 +3662,6 @@ mod tests { regex: false, center_on_match: false, search_on_input: true, - search_on_input_debounce_ms: 0, }, cx, ); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 81ad9ac3b41bae..acd6576ce298ef 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -39,7 +39,6 @@ use std::{ ops::{Not, Range}, pin::pin, sync::Arc, - time::Duration, }; use ui::{ CommonAnimationExt, IconButtonShape, KeyBinding, Toggleable, Tooltip, prelude::*, @@ -271,7 +270,6 @@ pub struct ProjectSearchView { included_opened_only: bool, regex_language: Option>, results_collapsed: bool, - current_search_on_input: Task<()>, _subscriptions: Vec, } @@ -881,11 +879,11 @@ impl ProjectSearchView { this.toggle_search_option(SearchOptions::CASE_SENSITIVE, cx); } } - - let search_settings = &EditorSettings::get_global(cx).search; - if search_settings.search_on_input { - if this.query_editor.read(cx).is_empty(cx) { - this.current_search_on_input = Task::ready(()); + // Trigger search on input: + if EditorSettings::get_global(cx).search.search_on_input { + let query = this.search_query_text(cx); + if query.is_empty() { + // Clear results immediately when query is empty and abort ongoing search this.entity.update(cx, |model, cx| { model.pending_search = None; model.match_ranges.clear(); @@ -895,18 +893,7 @@ impl ProjectSearchView { cx.notify(); }); } else { - let debounce = search_settings.search_on_input_debounce_ms; - this.current_search_on_input = cx.spawn(async move |this, cx| { - if debounce > 0 { - cx.background_executor() - .timer(Duration::from_millis(debounce)) - .await; - } - this.update(cx, |this, cx| { - this.search(cx); - }) - .ok(); - }); + this.search(cx); } } } @@ -1028,7 +1015,6 @@ impl ProjectSearchView { included_opened_only: false, regex_language: None, results_collapsed: false, - current_search_on_input: Task::ready(()), _subscriptions: subscriptions, }; diff --git a/crates/settings_content/src/editor.rs b/crates/settings_content/src/editor.rs index 88616e065e31be..a2f53e1b9e309e 100644 --- a/crates/settings_content/src/editor.rs +++ b/crates/settings_content/src/editor.rs @@ -828,14 +828,8 @@ pub struct SearchSettingsContent { pub regex: Option, /// Whether to center the cursor on each search match when navigating. pub center_on_match: Option, - /// Whether to search on input in project search. + /// Whether to search on input. pub search_on_input: Option, - /// Debounce time in milliseconds for search on input in project search. - /// - /// Set to 0 to disable debouncing. - /// - /// Default: 200 - pub search_on_input_debounce_ms: Option, } #[with_fallible_options] diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index b594c21cfc59e6..0725917fa3d466 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -2999,7 +2999,7 @@ fn languages_and_tools_page(cx: &App) -> SettingsPage { } fn search_and_files_page() -> SettingsPage { - fn search_section() -> [SettingsPageItem; 11] { + fn search_section() -> [SettingsPageItem; 10] { [ SettingsPageItem::SectionHeader("Search"), SettingsPageItem::SettingItem(SettingItem { @@ -3135,7 +3135,7 @@ fn search_and_files_page() -> SettingsPage { }), SettingsPageItem::SettingItem(SettingItem { title: "Search on Input", - description: "Whether to search on input in project search.", + description: "Whether to search on input.", field: Box::new(SettingField { json_path: Some("editor.search.search_on_input"), pick: |settings_content| { @@ -3156,29 +3156,6 @@ fn search_and_files_page() -> SettingsPage { metadata: None, files: USER, }), - SettingsPageItem::SettingItem(SettingItem { - title: "Search on Input Debounce", - description: "Debounce time in milliseconds for search on input (set to 0 to disable debouncing).", - field: Box::new(SettingField { - json_path: Some("editor.search.search_on_input_debounce_ms"), - pick: |settings_content| { - settings_content - .editor - .search - .as_ref() - .and_then(|search| search.search_on_input_debounce_ms.as_ref()) - }, - write: |settings_content, value| { - settings_content - .editor - .search - .get_or_insert_default() - .search_on_input_debounce_ms = value; - }, - }), - metadata: None, - files: USER, - }), SettingsPageItem::SettingItem(SettingItem { title: "Seed Search Query From Cursor", description: "When to populate a new search's query based on the text under the cursor.", diff --git a/docs/src/reference/all-settings.md b/docs/src/reference/all-settings.md index f47006a5b904b5..56f5b234aef463 100644 --- a/docs/src/reference/all-settings.md +++ b/docs/src/reference/all-settings.md @@ -3272,15 +3272,9 @@ Non-negative `integer` values ### Search On Input -- Description: Whether to search on input in project search. -- Setting: `search_on_input` -- Default: `false` - -### Search On Input Debounce Ms - -- Description: Debounce time in milliseconds for search on input in project search. Set to 0 to disable debouncing. -- Setting: `search_on_input_debounce_ms` -- Default: `200` +- Description: Whether to search on input. +- Setting: `search_on_input +- Default: `true` ### Center On Match From 81e3be8f25aff6291fab679a6aa4deb60a68e5a3 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 14 Feb 2026 10:19:34 +0200 Subject: [PATCH 3/3] Revert "Add search_on_input setting to Project Search (#42889)" This reverts commit fee42e1d89cc5e50df3579e873ce5280650285e8. --- assets/settings/default.json | 2 - crates/editor/src/editor_settings.rs | 3 - crates/search/src/buffer_search.rs | 85 --------------------------- crates/search/src/project_search.rs | 63 +++++--------------- crates/settings_content/src/editor.rs | 2 - crates/settings_ui/src/page_data.rs | 25 +------- docs/src/reference/all-settings.md | 12 ++-- 7 files changed, 21 insertions(+), 171 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 111b42cdcc561a..ae8b320678d98b 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -667,8 +667,6 @@ "regex": false, // Whether to center the cursor on each search match when navigating. "center_on_match": false, - // Whether to search on input. - "search_on_input": true, }, // When to populate a new search's query based on the text under the cursor. // This setting can take the following three values: diff --git a/crates/editor/src/editor_settings.rs b/crates/editor/src/editor_settings.rs index 654a541a699b62..47210a7561f4a3 100644 --- a/crates/editor/src/editor_settings.rs +++ b/crates/editor/src/editor_settings.rs @@ -175,8 +175,6 @@ pub struct SearchSettings { pub regex: bool, /// Whether to center the cursor on each search match when navigating. pub center_on_match: bool, - /// Whether to search on input. - pub search_on_input: bool, } impl EditorSettings { @@ -273,7 +271,6 @@ impl Settings for EditorSettings { include_ignored: search.include_ignored.unwrap(), regex: search.regex.unwrap(), center_on_match: search.center_on_match.unwrap(), - search_on_input: search.search_on_input.unwrap(), }, auto_signature_help: editor.auto_signature_help.unwrap(), show_signature_help_after_edits: editor.show_signature_help_after_edits.unwrap(), diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index a8639b70cd75ca..25cbb4ef4cdb65 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -3421,7 +3421,6 @@ mod tests { include_ignored: false, regex: false, center_on_match: false, - search_on_input: false, }, cx, ); @@ -3485,7 +3484,6 @@ mod tests { include_ignored: false, regex: false, center_on_match: false, - search_on_input: false, }, cx, ); @@ -3524,7 +3522,6 @@ mod tests { include_ignored: false, regex: false, center_on_match: false, - search_on_input: false, }, cx, ); @@ -3607,91 +3604,9 @@ mod tests { include_ignored: Some(search_settings.include_ignored), regex: Some(search_settings.regex), center_on_match: Some(search_settings.center_on_match), - search_on_input: Some(search_settings.search_on_input), }); }); }); }); } - #[gpui::test] - async fn test_search_on_input_setting(cx: &mut TestAppContext) { - let (editor, search_bar, cx) = init_test(cx); - - update_search_settings( - SearchSettings { - button: true, - whole_word: false, - case_sensitive: false, - include_ignored: false, - regex: false, - center_on_match: false, - search_on_input: false, - }, - cx, - ); - - search_bar.update_in(cx, |search_bar, window, cx| { - search_bar.show(window, cx); - search_bar.query_editor.update(cx, |query_editor, cx| { - query_editor.buffer().update(cx, |buffer, cx| { - buffer.edit( - [(MultiBufferOffset(0)..MultiBufferOffset(0), "expression")], - None, - cx, - ); - }); - }); - }); - - cx.background_executor.run_until_parked(); - - editor.update_in(cx, |editor, window, cx| { - let highlights = editor.all_text_background_highlights(window, cx); - assert!( - highlights.is_empty(), - "No highlights should appear when search_on_input is false" - ); - }); - - update_search_settings( - SearchSettings { - button: true, - whole_word: false, - case_sensitive: false, - include_ignored: false, - regex: false, - center_on_match: false, - search_on_input: true, - }, - cx, - ); - - search_bar.update_in(cx, |search_bar, window, cx| { - search_bar.dismiss(&Dismiss, window, cx); - search_bar.show(window, cx); - }); - - search_bar - .update_in(cx, |search_bar, window, cx| { - search_bar.search("expression", None, true, window, cx) - }) - .await - .unwrap(); - - editor.update_in(cx, |editor, window, cx| { - let highlights = display_points_of(editor.all_text_background_highlights(window, cx)); - assert_eq!( - highlights.len(), - 2, - "Should find 2 matches for 'expression' when search_on_input is true" - ); - assert_eq!( - highlights, - &[ - DisplayPoint::new(DisplayRow(0), 10)..DisplayPoint::new(DisplayRow(0), 20), - DisplayPoint::new(DisplayRow(1), 9)..DisplayPoint::new(DisplayRow(1), 19), - ] - ); - }); - } } diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index acd6576ce298ef..7c85077c488371 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -869,32 +869,15 @@ impl ProjectSearchView { // Subscribe to query_editor in order to reraise editor events for workspace item activation purposes subscriptions.push( cx.subscribe(&query_editor, |this, _, event: &EditorEvent, cx| { - if let EditorEvent::Edited { .. } = event { - if EditorSettings::get_global(cx).use_smartcase_search { - let query = this.search_query_text(cx); - if !query.is_empty() - && this.search_options.contains(SearchOptions::CASE_SENSITIVE) - != contains_uppercase(&query) - { - this.toggle_search_option(SearchOptions::CASE_SENSITIVE, cx); - } - } - // Trigger search on input: - if EditorSettings::get_global(cx).search.search_on_input { - let query = this.search_query_text(cx); - if query.is_empty() { - // Clear results immediately when query is empty and abort ongoing search - this.entity.update(cx, |model, cx| { - model.pending_search = None; - model.match_ranges.clear(); - model.excerpts.update(cx, |excerpts, cx| excerpts.clear(cx)); - model.no_results = None; - model.limit_reached = false; - cx.notify(); - }); - } else { - this.search(cx); - } + if let EditorEvent::Edited { .. } = event + && EditorSettings::get_global(cx).use_smartcase_search + { + let query = this.search_query_text(cx); + if !query.is_empty() + && this.search_options.contains(SearchOptions::CASE_SENSITIVE) + != contains_uppercase(&query) + { + this.toggle_search_option(SearchOptions::CASE_SENSITIVE, cx); } } cx.emit(ViewEvent::EditorEvent(event.clone())) @@ -1546,11 +1529,7 @@ impl ProjectSearchView { editor.scroll(Point::default(), Some(Axis::Vertical), window, cx); } }); - let should_auto_focus = !EditorSettings::get_global(cx).search.search_on_input; - if is_new_search - && self.query_editor.focus_handle(cx).is_focused(window) - && should_auto_focus - { + if is_new_search && self.query_editor.focus_handle(cx).is_focused(window) { self.focus_results_editor(window, cx); } } @@ -1613,13 +1592,9 @@ impl ProjectSearchView { v_flex() .gap_1() .child( - Label::new(if EditorSettings::get_global(cx).search.search_on_input { - "Start typing to search. For more options:" - } else { - "Hit enter to search. For more options:" - }) - .color(Color::Muted) - .mb_2(), + Label::new("Hit enter to search. For more options:") + .color(Color::Muted) + .mb_2(), ) .child( Button::new("filter-paths", "Include/exclude specific paths") @@ -2562,8 +2537,7 @@ pub mod tests { use project::FakeFs; use serde_json::json; use settings::{ - InlayHintSettingsContent, SearchSettingsContent, SettingsStore, ThemeColorsContent, - ThemeStyleContent, + InlayHintSettingsContent, SettingsStore, ThemeColorsContent, ThemeStyleContent, }; use util::{path, paths::PathStyle, rel_path::rel_path}; use util_macros::perf; @@ -4782,15 +4756,6 @@ pub mod tests { let settings = SettingsStore::test(cx); cx.set_global(settings); - SettingsStore::update_global(cx, |store, cx| { - store.update_user_settings(cx, |settings| { - settings.editor.search = Some(SearchSettingsContent { - search_on_input: Some(false), - ..Default::default() - }); - }); - }); - theme::init(theme::LoadThemes::JustBase, cx); editor::init(cx); diff --git a/crates/settings_content/src/editor.rs b/crates/settings_content/src/editor.rs index a2f53e1b9e309e..4d824e85e0e2ee 100644 --- a/crates/settings_content/src/editor.rs +++ b/crates/settings_content/src/editor.rs @@ -828,8 +828,6 @@ pub struct SearchSettingsContent { pub regex: Option, /// Whether to center the cursor on each search match when navigating. pub center_on_match: Option, - /// Whether to search on input. - pub search_on_input: Option, } #[with_fallible_options] diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index 0725917fa3d466..738eff917bc57a 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -2999,7 +2999,7 @@ fn languages_and_tools_page(cx: &App) -> SettingsPage { } fn search_and_files_page() -> SettingsPage { - fn search_section() -> [SettingsPageItem; 10] { + fn search_section() -> [SettingsPageItem; 9] { [ SettingsPageItem::SectionHeader("Search"), SettingsPageItem::SettingItem(SettingItem { @@ -3133,29 +3133,6 @@ fn search_and_files_page() -> SettingsPage { metadata: None, files: USER, }), - SettingsPageItem::SettingItem(SettingItem { - title: "Search on Input", - description: "Whether to search on input.", - field: Box::new(SettingField { - json_path: Some("editor.search.search_on_input"), - pick: |settings_content| { - settings_content - .editor - .search - .as_ref() - .and_then(|search| search.search_on_input.as_ref()) - }, - write: |settings_content, value| { - settings_content - .editor - .search - .get_or_insert_default() - .search_on_input = value; - }, - }), - metadata: None, - files: USER, - }), SettingsPageItem::SettingItem(SettingItem { title: "Seed Search Query From Cursor", description: "When to populate a new search's query based on the text under the cursor.", diff --git a/docs/src/reference/all-settings.md b/docs/src/reference/all-settings.md index 56f5b234aef463..4aaf979993802d 100644 --- a/docs/src/reference/all-settings.md +++ b/docs/src/reference/all-settings.md @@ -3270,12 +3270,6 @@ Non-negative `integer` values - Setting: `regex` - Default: `false` -### Search On Input - -- Description: Whether to search on input. -- Setting: `search_on_input -- Default: `true` - ### Center On Match - Description: Whether to center the cursor on each search match when navigating. @@ -3288,6 +3282,12 @@ Non-negative `integer` values - Setting: `search_wrap` - Default: `true` +## Center on Match + +- Description: If `center_on_match` is enabled, the editor will center the cursor on the current match when searching. +- Setting: `center_on_match` +- Default: `false` + ## Seed Search Query From Cursor - Description: When to populate a new search's query based on the text under the cursor.