Map Fn+Cursor_move to home/end (#728)

Fn modifier switches cursor_left to home key, cursor_right to end key
This commit is contained in:
bokidori 2024-07-28 21:29:50 +02:00 committed by GitHub
parent bd50964651
commit 72d88a5298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,6 +208,7 @@ public final class KeyModifier
case Keyevent: name = apply_fn_keyevent(k.getKeyevent()); break; case Keyevent: name = apply_fn_keyevent(k.getKeyevent()); break;
case Event: name = apply_fn_event(k.getEvent()); break; case Event: name = apply_fn_event(k.getEvent()); break;
case Placeholder: name = apply_fn_placeholder(k.getPlaceholder()); break; case Placeholder: name = apply_fn_placeholder(k.getPlaceholder()); break;
case Cursor_move: name = apply_fn_cursormove(k.getCursorMove()); break;
} }
return (name == null) ? k : KeyValue.getKeyByName(name); return (name == null) ? k : KeyValue.getKeyByName(name);
} }
@ -253,6 +254,16 @@ public final class KeyModifier
} }
} }
private static String apply_fn_cursormove(short cur)
{
switch (cur)
{
case -1 : return "home"; // cursor_left
case 1 : return "end"; // cursor_right
default: return null;
}
}
/** Return the name of modified key, or [null]. */ /** Return the name of modified key, or [null]. */
private static String apply_fn_char(char c) private static String apply_fn_char(char c)
{ {