From 69cafdfb0d75bf2d756e355f5706252b7e3fdbd8 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:51:43 +0200 Subject: [PATCH] Disable indent guides for single line editors (cherry-pick #12584) (#12595) Cherry-picked Disable indent guides for single line editors (#12584) This PR disables indent guides by default for single line editors. Right now indent guides show up in the project search editor (which is only a single line) image Release Notes: - Fixed an issue where indent guides would show up in a single line editor (e.g. project search, buffer search) Co-authored-by: Bennet Bo Fenner --- crates/editor/src/editor.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 347ea8e88b3ef8d5fe729ee1897654c8c64a46e2..ded5606cf2e4e8e17a0d8bcb6a0ddde094fd9312 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1697,6 +1697,12 @@ impl Editor { cx.on_focus(&focus_handle, Self::handle_focus).detach(); cx.on_blur(&focus_handle, Self::handle_blur).detach(); + let show_indent_guides = if mode == EditorMode::SingleLine { + Some(false) + } else { + None + }; + let mut this = Self { focus_handle, buffer: buffer.clone(), @@ -1726,7 +1732,7 @@ impl Editor { show_git_diff_gutter: None, show_code_actions: None, show_wrap_guides: None, - show_indent_guides: None, + show_indent_guides, placeholder_text: None, highlight_order: 0, highlighted_rows: HashMap::default(),