Fix the double click and update the default settings (#9214)

This commit is contained in:
Kirill Bulatov 2024-03-12 12:15:55 +02:00 committed by GitHub
parent 44adb0a316
commit 3be1402a3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -143,12 +143,12 @@
// What to do when multibuffer is double clicked in some of its excerpts // What to do when multibuffer is double clicked in some of its excerpts
// (parts of singleton buffers). // (parts of singleton buffers).
// May take 2 values: // 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" // "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", // "double_click_in_multibuffer": "open",
// For the case of "open", regular selection behavior can be achieved by holding `alt` when double clicking. // 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": { "gutter": {
// Whether to show line numbers in the gutter. // Whether to show line numbers in the gutter.
"line_numbers": true, "line_numbers": true,

View file

@ -38,8 +38,8 @@ pub enum SeedQuerySetting {
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum DoubleClickInMultibuffer { pub enum DoubleClickInMultibuffer {
/// Behave as a regular buffer and select the whole word. /// Behave as a regular buffer and select the whole word.
Select,
#[default] #[default]
Select,
/// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click. /// 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. /// Otherwise, behave as a regular buffer and select the whole word.
Open, Open,
@ -145,7 +145,7 @@ pub struct EditorSettingsContent {
/// What to do when multibuffer is double clicked in some of its excerpts /// What to do when multibuffer is double clicked in some of its excerpts
/// (parts of singleton buffers). /// (parts of singleton buffers).
/// ///
/// Default: open /// Default: select
pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>, pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
} }

View file

@ -400,7 +400,7 @@ impl EditorElement {
return; return;
} }
if click_count == 2 { if click_count == 2 && !editor.buffer().read(cx).is_singleton() {
match EditorSettings::get_global(cx).double_click_in_multibuffer { match EditorSettings::get_global(cx).double_click_in_multibuffer {
DoubleClickInMultibuffer::Select => { DoubleClickInMultibuffer::Select => {
// do nothing special on double click, all selection logic is below // do nothing special on double click, all selection logic is below