mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:37:34 +00:00
HackStudio: Don't track ctrl key state manually
Since we only need it in the mouse and key event handlers, we can get the ctrl key state from the event. :^)
This commit is contained in:
parent
77e9eadd9d
commit
c3a79e1483
2 changed files with 2 additions and 14 deletions
|
@ -222,7 +222,7 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
|
||||||
if (hovering_lines_ruler && !is_in_drag_select())
|
if (hovering_lines_ruler && !is_in_drag_select())
|
||||||
set_override_cursor(Gfx::StandardCursor::Arrow);
|
set_override_cursor(Gfx::StandardCursor::Arrow);
|
||||||
else if (m_hovering_editor)
|
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()) {
|
for (auto& span : document().spans()) {
|
||||||
if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) {
|
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)
|
if (event.ctrl() && event.key() == Key_Space) {
|
||||||
m_holding_ctrl = true;
|
|
||||||
|
|
||||||
if (m_holding_ctrl && event.key() == Key_Space) {
|
|
||||||
autocomplete_action();
|
autocomplete_action();
|
||||||
}
|
}
|
||||||
GUI::TextEditor::keydown_event(event);
|
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)
|
void Editor::enter_event(Core::Event& event)
|
||||||
{
|
{
|
||||||
m_hovering_editor = true;
|
m_hovering_editor = true;
|
||||||
|
|
|
@ -73,7 +73,6 @@ private:
|
||||||
virtual void mousemove_event(GUI::MouseEvent&) override;
|
virtual void mousemove_event(GUI::MouseEvent&) override;
|
||||||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||||
virtual void keyup_event(GUI::KeyEvent&) override;
|
|
||||||
virtual void enter_event(Core::Event&) override;
|
virtual void enter_event(Core::Event&) override;
|
||||||
virtual void leave_event(Core::Event&) override;
|
virtual void leave_event(Core::Event&) override;
|
||||||
|
|
||||||
|
@ -105,7 +104,6 @@ private:
|
||||||
GUI::TextPosition m_previous_text_position { 0, 0 };
|
GUI::TextPosition m_previous_text_position { 0, 0 };
|
||||||
bool m_hovering_editor { false };
|
bool m_hovering_editor { false };
|
||||||
bool m_hovering_link { false };
|
bool m_hovering_link { false };
|
||||||
bool m_holding_ctrl { false };
|
|
||||||
bool m_autocomplete_in_focus { false };
|
bool m_autocomplete_in_focus { false };
|
||||||
|
|
||||||
OwnPtr<LanguageClient> m_language_client;
|
OwnPtr<LanguageClient> m_language_client;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue