mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-22 19:07:20 +03:00
LibGUI: Make Ctrl-Shift-Home/-End work again
Previously, the initial call to update_selection() was missing, so if no text was already selected, then Ctrl-Shift-End would only move the cursor to the document end, but not select any text.
This commit is contained in:
parent
2f023acf78
commit
68884eefc6
Notes:
sideshowbarker
2024-07-18 02:21:42 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/68884eefc62 Pull-request: https://github.com/SerenityOS/serenity/pull/10476
@ -120,37 +120,29 @@ bool EditingEngine::on_key(const KeyEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.key() == KeyCode::Key_Home) {
|
if (event.key() == KeyCode::Key_Home) {
|
||||||
|
m_editor->update_selection(event.shift());
|
||||||
if (event.ctrl()) {
|
if (event.ctrl()) {
|
||||||
move_to_first_line();
|
move_to_first_line();
|
||||||
if (event.shift() && m_editor->selection().start().is_valid()) {
|
|
||||||
m_editor->selection().set_end(m_editor->cursor());
|
|
||||||
m_editor->did_update_selection();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
m_editor->update_selection(event.shift());
|
|
||||||
move_to_line_beginning();
|
move_to_line_beginning();
|
||||||
if (event.shift() && m_editor->selection().start().is_valid()) {
|
}
|
||||||
m_editor->selection().set_end(m_editor->cursor());
|
if (event.shift() && m_editor->selection().start().is_valid()) {
|
||||||
m_editor->did_update_selection();
|
m_editor->selection().set_end(m_editor->cursor());
|
||||||
}
|
m_editor->did_update_selection();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key() == KeyCode::Key_End) {
|
if (event.key() == KeyCode::Key_End) {
|
||||||
|
m_editor->update_selection(event.shift());
|
||||||
if (event.ctrl()) {
|
if (event.ctrl()) {
|
||||||
move_to_last_line();
|
move_to_last_line();
|
||||||
if (event.shift() && m_editor->selection().start().is_valid()) {
|
|
||||||
m_editor->selection().set_end(m_editor->cursor());
|
|
||||||
m_editor->did_update_selection();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
m_editor->update_selection(event.shift());
|
|
||||||
move_to_line_end();
|
move_to_line_end();
|
||||||
if (event.shift() && m_editor->selection().start().is_valid()) {
|
}
|
||||||
m_editor->selection().set_end(m_editor->cursor());
|
if (event.shift() && m_editor->selection().start().is_valid()) {
|
||||||
m_editor->did_update_selection();
|
m_editor->selection().set_end(m_editor->cursor());
|
||||||
}
|
m_editor->did_update_selection();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user