From f4306d977f87bfe918524a18ade3e04469d0fc74 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 11 Oct 2022 09:28:17 -0700 Subject: [PATCH] Refresh scrollbar auto-hide setting when opening a new editor --- crates/editor/src/editor.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 2b1d99a24c5984705d2228a3406afc3d11c53031..8df8a29360550e62455ed1015e05281c0d8eddab 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -330,10 +330,6 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_async_action(Editor::confirm_rename); cx.add_async_action(Editor::find_all_references); - cx.set_global(ScrollbarAutoHide( - cx.platform().should_auto_hide_scrollbars(), - )); - hover_popover::init(cx); link_go_to_definition::init(cx); mouse_context_menu::init(cx); @@ -1076,6 +1072,11 @@ impl Editor { let editor_created_event = EditorCreated(cx.handle()); cx.emit_global(editor_created_event); + if mode == EditorMode::Full { + let should_auto_hide_scrollbars = cx.platform().should_auto_hide_scrollbars(); + cx.set_global(ScrollbarAutoHide(should_auto_hide_scrollbars)); + } + this.report_event("open editor", cx); this }