mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 13:02:28 +00:00
LibWeb: Re-assign cmd+arrow key events to home/end keys on macOS
In text documents, pressing the left/right arrow keys with the cmd key pressed should be treated as home/end key presses.
This commit is contained in:
parent
a0072f422a
commit
bf9d05d97a
Notes:
github-actions[bot]
2024-09-06 05:43:52 +00:00
Author: https://github.com/trflynn89
Commit: bf9d05d97a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1292
1 changed files with 13 additions and 0 deletions
|
@ -929,6 +929,19 @@ bool EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u32 code
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(AK_OS_MACOS)
|
||||||
|
if ((modifiers & UIEvents::Mod_Super) != 0) {
|
||||||
|
if (key == UIEvents::KeyCode::Key_Left) {
|
||||||
|
key = UIEvents::KeyCode::Key_Home;
|
||||||
|
modifiers &= ~UIEvents::Mod_Super;
|
||||||
|
}
|
||||||
|
if (key == UIEvents::KeyCode::Key_Right) {
|
||||||
|
key = UIEvents::KeyCode::Key_End;
|
||||||
|
modifiers &= ~UIEvents::Mod_Super;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (key == UIEvents::KeyCode::Key_Left || key == UIEvents::KeyCode::Key_Right) {
|
if (key == UIEvents::KeyCode::Key_Left || key == UIEvents::KeyCode::Key_Right) {
|
||||||
auto increment_or_decrement_cursor = [&]() {
|
auto increment_or_decrement_cursor = [&]() {
|
||||||
if ((modifiers & UIEvents::Mod_PlatformWordJump) == 0) {
|
if ((modifiers & UIEvents::Mod_PlatformWordJump) == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue