From 95df712c2eef57fd7e85527f86fd85bc29a17acf Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Tue, 10 Jan 2023 20:12:40 -0700 Subject: [PATCH] HackStudio: Hide autocomplete popup when switching tabs --- Userland/DevTools/HackStudio/HackStudioWidget.cpp | 3 +++ Userland/Libraries/LibGUI/TextEditor.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 7ab2a8a15c..1fe5258218 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -1178,6 +1178,9 @@ void HackStudioWidget::set_current_editor_tab_widget(RefPtr tab_ void HackStudioWidget::set_current_editor_wrapper(RefPtr editor_wrapper) { + if (m_current_editor_wrapper) + m_current_editor_wrapper->editor().hide_autocomplete(); + m_current_editor_wrapper = editor_wrapper; update_window_title(); update_current_editor_title(); diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index f5586d000b..5aac3594ec 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -203,6 +203,7 @@ public: bool should_autocomplete_automatically() const { return m_autocomplete_timer; } void set_should_autocomplete_automatically(bool); + void hide_autocomplete(); Optional const& substitution_code_point() const { return m_substitution_code_point; } void set_substitution_code_point(Optional code_point); @@ -320,7 +321,6 @@ private: void try_update_autocomplete(Function callback = {}); void force_update_autocomplete(Function callback = {}); void hide_autocomplete_if_needed(); - void hide_autocomplete(); int icon_size() const { return 16; } int icon_padding() const { return 2; }