summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-31 16:51:50 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-01 10:29:53 +0200
commit88624343766fa06c656160e176e09af122d78a87 (patch)
tree34eace75d637b412bffd7915f25d731c99f63f69
parent8690f36eb36021188e6a1a2c6a39d0b34d234f51 (diff)
downloadserenity-88624343766fa06c656160e176e09af122d78a87.zip
LibGUI: Allow Tab key to switch focus from non-editable GUI::TextEditor
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 2a0d5d76e1..1d7fd1b251 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -766,6 +766,9 @@ void TextEditor::select_all()
void TextEditor::keydown_event(KeyEvent& event)
{
+ if (!is_editable() && event.key() == KeyCode::Key_Tab)
+ return AbstractScrollableWidget::keydown_event(event);
+
if (m_autocomplete_box && m_autocomplete_box->is_visible() && (event.key() == KeyCode::Key_Return || event.key() == KeyCode::Key_Tab)) {
TemporaryChange change { m_should_keep_autocomplete_box, true };
if (m_autocomplete_box->apply_suggestion() == CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::Yes)
@@ -868,8 +871,6 @@ void TextEditor::keydown_event(KeyEvent& event)
}
if (event.key() == KeyCode::Key_Tab) {
- if (!is_editable())
- return;
if (has_selection()) {
if (event.modifiers() == Mod_Shift) {
unindent_selection();