diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index bfa82b7c40..27fbc77434 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -1556,6 +1556,7 @@ impl ContextEditor { let mut editor = Editor::for_buffer(context.read(cx).buffer().clone(), None, cx); editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx); editor.set_show_line_numbers(false, cx); + editor.set_show_scrollbars(false, cx); editor.set_show_git_diff_gutter(false, cx); editor.set_show_code_actions(false, cx); editor.set_show_runnables(false, cx); diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d0571f78fe..ac6020767e 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -606,6 +606,7 @@ pub struct Editor { mode: EditorMode, show_breadcrumbs: bool, show_gutter: bool, + show_scrollbars: bool, show_line_numbers: Option, use_relative_line_numbers: Option, show_git_diff_gutter: Option, @@ -1235,6 +1236,7 @@ impl Editor { project, blink_manager: blink_manager.clone(), show_local_selections: true, + show_scrollbars: true, mode, show_breadcrumbs: EditorSettings::get_global(cx).toolbar.breadcrumbs, show_gutter: mode == EditorMode::Full, @@ -11260,6 +11262,11 @@ impl Editor { cx.notify(); } + pub fn set_show_scrollbars(&mut self, show_scrollbars: bool, cx: &mut ViewContext) { + self.show_scrollbars = show_scrollbars; + cx.notify(); + } + pub fn set_show_line_numbers(&mut self, show_line_numbers: bool, cx: &mut ViewContext) { self.show_line_numbers = Some(show_line_numbers); cx.notify(); diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 537ab00353..f44571701f 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1192,12 +1192,13 @@ impl EditorElement { ); let scrollbar_settings = EditorSettings::get_global(cx).scrollbar; - let show_scrollbars = match scrollbar_settings.show { - ShowScrollbar::Auto => { - let editor = self.editor.read(cx); - let is_singleton = editor.is_singleton(cx); - // Git - (is_singleton && scrollbar_settings.git_diff && !snapshot.diff_map.is_empty()) + let show_scrollbars = self.editor.read(cx).show_scrollbars + && match scrollbar_settings.show { + ShowScrollbar::Auto => { + let editor = self.editor.read(cx); + let is_singleton = editor.is_singleton(cx); + // Git + (is_singleton && scrollbar_settings.git_diff && !snapshot.diff_map.is_empty()) || // Buffer Search Results (is_singleton && scrollbar_settings.search_results && editor.has_background_highlights::()) @@ -1213,11 +1214,11 @@ impl EditorElement { || // Scrollmanager editor.scroll_manager.scrollbars_visible() - } - ShowScrollbar::System => self.editor.read(cx).scroll_manager.scrollbars_visible(), - ShowScrollbar::Always => true, - ShowScrollbar::Never => false, - }; + } + ShowScrollbar::System => self.editor.read(cx).scroll_manager.scrollbars_visible(), + ShowScrollbar::Always => true, + ShowScrollbar::Never => false, + }; let axes: AxisPair = scrollbar_settings.axes.into(); diff --git a/crates/editor/src/hunk_diff.rs b/crates/editor/src/hunk_diff.rs index 76e7a92036..748aa3bd87 100644 --- a/crates/editor/src/hunk_diff.rs +++ b/crates/editor/src/hunk_diff.rs @@ -1155,6 +1155,11 @@ fn editor_with_deleted_text( editor.set_soft_wrap_mode(language::language_settings::SoftWrap::None, cx); editor.set_show_wrap_guides(false, cx); editor.set_show_gutter(false, cx); + editor.set_show_line_numbers(false, cx); + editor.set_show_scrollbars(false, cx); + editor.set_show_runnables(false, cx); + editor.set_show_git_diff_gutter(false, cx); + editor.set_show_code_actions(false, cx); editor.scroll_manager.set_forbid_vertical_scroll(true); editor.set_read_only(true); editor.set_show_inline_completions(Some(false), cx); @@ -1166,7 +1171,7 @@ fn editor_with_deleted_text( false, cx, ); - editor.set_current_line_highlight(Some(CurrentLineHighlight::None)); // + editor.set_current_line_highlight(Some(CurrentLineHighlight::None)); editor ._subscriptions .extend([cx.on_blur(&editor.focus_handle, |editor, cx| { diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index ba9375b7a3..99e1febd9b 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -269,6 +269,7 @@ impl RateCompletionModal { let mut editor = Editor::multi_line(cx); editor.set_soft_wrap_mode(language_settings::SoftWrap::EditorWidth, cx); editor.set_show_line_numbers(false, cx); + editor.set_show_scrollbars(false, cx); editor.set_show_git_diff_gutter(false, cx); editor.set_show_code_actions(false, cx); editor.set_show_runnables(false, cx);