mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10: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. (cherry picked from commit bf9d05d97a570e8d4ebd83ca7e757938c2b504b3)
This commit is contained in:
1 parent
5bc052948a
commit
071d85e1cc
1 file changed
+13
@@ -951,6 +951,19 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
||||
return EventResult::Handled;
|
||||
}
|
||||
|
||||
#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) {
|
||||
auto increment_or_decrement_cursor = [&]() {
|
||||
if ((modifiers & UIEvents::Mod_PlatformWordJump) == 0) {
|
||||
|
||||
Reference in new issue
Block a user