mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
HexEditor: Add support for handling PageUp and PageDown key events
In such case, move the cursor up or down the amount of bytes per row, multiplied by the visible content rectangle height, if possible.
This commit is contained in:
parent
c8e691f917
commit
6a998c1a8b
Notes:
sideshowbarker
2024-07-17 18:29:04 +09:00
Author: https://github.com/supercomputer7
Commit: 6a998c1a8b
Pull-request: https://github.com/SerenityOS/serenity/pull/12652
1 changed files with 16 additions and 0 deletions
|
@ -432,6 +432,22 @@ void HexEditor::keydown_event(GUI::KeyEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.key() == KeyCode::Key_PageUp) {
|
||||
auto cursor_location_change = min(bytes_per_row() * visible_content_rect().height(), m_position);
|
||||
if (cursor_location_change > 0) {
|
||||
advance_cursor_backwards(cursor_location_change);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key() == KeyCode::Key_PageDown) {
|
||||
auto cursor_location_change = min(bytes_per_row() * visible_content_rect().height(), m_document->size() - m_position);
|
||||
if (cursor_location_change > 0) {
|
||||
advance_cursor_forward(cursor_location_change);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_readonly() && !event.ctrl() && !event.alt() && !event.text().is_empty()) {
|
||||
if (m_edit_mode == EditMode::Hex) {
|
||||
hex_mode_keydown_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue