diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index a01ae29201..49b1a8c1a2 100644 --- a/DevTools/HackStudio/Editor.cpp +++ b/DevTools/HackStudio/Editor.cpp @@ -222,7 +222,7 @@ void Editor::mousemove_event(GUI::MouseEvent& event) if (hovering_lines_ruler && !is_in_drag_select()) set_override_cursor(Gfx::StandardCursor::Arrow); else if (m_hovering_editor) - set_override_cursor(m_hovering_link && m_holding_ctrl ? Gfx::StandardCursor::Hand : Gfx::StandardCursor::IBeam); + set_override_cursor(m_hovering_link && event.ctrl() ? Gfx::StandardCursor::Hand : Gfx::StandardCursor::IBeam); for (auto& span : document().spans()) { if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) { @@ -349,10 +349,7 @@ void Editor::keydown_event(GUI::KeyEvent& event) } }; - if (event.key() == Key_Control) - m_holding_ctrl = true; - - if (m_holding_ctrl && event.key() == Key_Space) { + if (event.ctrl() && event.key() == Key_Space) { autocomplete_action(); } GUI::TextEditor::keydown_event(event); @@ -362,13 +359,6 @@ void Editor::keydown_event(GUI::KeyEvent& event) } } -void Editor::keyup_event(GUI::KeyEvent& event) -{ - if (event.key() == Key_Control) - m_holding_ctrl = false; - GUI::TextEditor::keyup_event(event); -} - void Editor::enter_event(Core::Event& event) { m_hovering_editor = true; diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index 941a02c238..3c5c78a667 100644 --- a/DevTools/HackStudio/Editor.h +++ b/DevTools/HackStudio/Editor.h @@ -73,7 +73,6 @@ private: virtual void mousemove_event(GUI::MouseEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; virtual void keydown_event(GUI::KeyEvent&) override; - virtual void keyup_event(GUI::KeyEvent&) override; virtual void enter_event(Core::Event&) override; virtual void leave_event(Core::Event&) override; @@ -105,7 +104,6 @@ private: GUI::TextPosition m_previous_text_position { 0, 0 }; bool m_hovering_editor { false }; bool m_hovering_link { false }; - bool m_holding_ctrl { false }; bool m_autocomplete_in_focus { false }; OwnPtr m_language_client;