LibWeb: Support jumping across word boundaries in text nodes
This also supports holding shift to modify the selection.
This commit is contained in:
parent
ecf2cc600b
commit
a0072f422a
Notes:
github-actions[bot]
2024-09-06 05:43:59 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a0072f422a1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1292
1 changed files with 8 additions and 2 deletions
|
@ -931,9 +931,15 @@ bool EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u32 code
|
|||
|
||||
if (key == UIEvents::KeyCode::Key_Left || key == UIEvents::KeyCode::Key_Right) {
|
||||
auto increment_or_decrement_cursor = [&]() {
|
||||
if ((modifiers & UIEvents::Mod_PlatformWordJump) == 0) {
|
||||
if (key == UIEvents::KeyCode::Key_Left)
|
||||
return document->decrement_cursor_position_offset();
|
||||
return document->increment_cursor_position_offset();
|
||||
}
|
||||
|
||||
if (key == UIEvents::KeyCode::Key_Left)
|
||||
return document->decrement_cursor_position_offset();
|
||||
return document->increment_cursor_position_offset();
|
||||
return document->decrement_cursor_position_to_previous_word();
|
||||
return document->increment_cursor_position_to_next_word();
|
||||
};
|
||||
|
||||
if ((modifiers & UIEvents::Mod_Shift) == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue