From 3be1402a3d55a6b68f5c5d03d6973b7b4ec18598 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 12 Mar 2024 12:15:55 +0200 Subject: [PATCH] Fix the double click and update the default settings (#9214) --- assets/settings/default.json | 6 +++--- crates/editor/src/editor_settings.rs | 4 ++-- crates/editor/src/element.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 3ef2da17b2..b43f36184c 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -143,12 +143,12 @@ // What to do when multibuffer is double clicked in some of its excerpts // (parts of singleton buffers). // May take 2 values: - // 1. Behave as a regular buffer and select the whole word. + // 1. Behave as a regular buffer and select the whole word (default). // "double_click_in_multibuffer": "select" - // 2. Open the excerpt clicked as a new buffer in the new tab (default). + // 2. Open the excerpt clicked as a new buffer in the new tab. // "double_click_in_multibuffer": "open", // For the case of "open", regular selection behavior can be achieved by holding `alt` when double clicking. - "double_click_in_multibuffer": "open", + "double_click_in_multibuffer": "select", "gutter": { // Whether to show line numbers in the gutter. "line_numbers": true, diff --git a/crates/editor/src/editor_settings.rs b/crates/editor/src/editor_settings.rs index 6e7fc08ef3..472209f20b 100644 --- a/crates/editor/src/editor_settings.rs +++ b/crates/editor/src/editor_settings.rs @@ -38,8 +38,8 @@ pub enum SeedQuerySetting { #[serde(rename_all = "snake_case")] pub enum DoubleClickInMultibuffer { /// Behave as a regular buffer and select the whole word. - Select, #[default] + Select, /// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click. /// Otherwise, behave as a regular buffer and select the whole word. Open, @@ -145,7 +145,7 @@ pub struct EditorSettingsContent { /// What to do when multibuffer is double clicked in some of its excerpts /// (parts of singleton buffers). /// - /// Default: open + /// Default: select pub double_click_in_multibuffer: Option, } diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 4f7631c2e4..55c451dd22 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -400,7 +400,7 @@ impl EditorElement { return; } - if click_count == 2 { + if click_count == 2 && !editor.buffer().read(cx).is_singleton() { match EditorSettings::get_global(cx).double_click_in_multibuffer { DoubleClickInMultibuffer::Select => { // do nothing special on double click, all selection logic is below