mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 15:28:55 +00:00
GTextEditor: Allow jumping lines by hitting Left/Right at start/end of line.
This commit is contained in:
parent
76094128e7
commit
b4a099d212
Notes:
sideshowbarker
2024-07-19 15:06:05 +09:00
Author: https://github.com/awesomekling
Commit: b4a099d212
1 changed files with 14 additions and 0 deletions
|
@ -307,6 +307,13 @@ void GTextEditor::keydown_event(GKeyEvent& event)
|
|||
set_cursor(m_cursor.line(), new_column);
|
||||
if (m_selection.start().is_valid())
|
||||
m_selection.set_end(m_cursor);
|
||||
} else if (m_cursor.line() > 0) {
|
||||
int new_line = m_cursor.line() - 1;
|
||||
int new_column = m_lines[new_line]->length();
|
||||
toggle_selection_if_needed_for_event(event);
|
||||
set_cursor(new_line, new_column);
|
||||
if (m_selection.start().is_valid())
|
||||
m_selection.set_end(m_cursor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -317,6 +324,13 @@ void GTextEditor::keydown_event(GKeyEvent& event)
|
|||
set_cursor(m_cursor.line(), new_column);
|
||||
if (m_selection.start().is_valid())
|
||||
m_selection.set_end(m_cursor);
|
||||
} else if (m_cursor.line() != line_count() - 1) {
|
||||
int new_line = m_cursor.line() + 1;
|
||||
int new_column = 0;
|
||||
toggle_selection_if_needed_for_event(event);
|
||||
set_cursor(new_line, new_column);
|
||||
if (m_selection.start().is_valid())
|
||||
m_selection.set_end(m_cursor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue