mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-09 11:26:41 +00:00
key: add additional keypad keys
Add additional keypad keys to the encoding scheme. This allows Ghostty to report KP_HOME and it's relatives. We also always check for a keyval first, so we can report KP_7, etc as opposed to ASCII '7'.
This commit is contained in:
@@ -117,6 +117,16 @@ pub const keys = keys: {
|
||||
result.set(.kp_subtract, kpDefault("m") ++ pcStyle("\x1bO{}m"));
|
||||
result.set(.kp_add, kpDefault("k") ++ pcStyle("\x1bO{}k"));
|
||||
result.set(.kp_enter, kpDefault("M") ++ pcStyle("\x1bO{}M") ++ .{.{ .sequence = "\r" }});
|
||||
result.set(.kp_up, pcStyle("\x1b[1;{}A") ++ cursorKey("\x1b[A", "\x1bOA"));
|
||||
result.set(.kp_down, pcStyle("\x1b[1;{}B") ++ cursorKey("\x1b[B", "\x1bOB"));
|
||||
result.set(.kp_right, pcStyle("\x1b[1;{}C") ++ cursorKey("\x1b[C", "\x1bOC"));
|
||||
result.set(.kp_left, pcStyle("\x1b[1;{}D") ++ cursorKey("\x1b[D", "\x1bOD"));
|
||||
result.set(.kp_home, pcStyle("\x1b[1;{}H") ++ cursorKey("\x1b[H", "\x1bOH"));
|
||||
result.set(.kp_end, pcStyle("\x1b[1;{}F") ++ cursorKey("\x1b[F", "\x1bOF"));
|
||||
result.set(.kp_insert, pcStyle("\x1b[2;{}~") ++ .{.{ .sequence = "\x1B[2~" }});
|
||||
result.set(.kp_delete, pcStyle("\x1b[3;{}~") ++ .{.{ .sequence = "\x1B[3~" }});
|
||||
result.set(.kp_page_up, pcStyle("\x1b[5;{}~") ++ .{.{ .sequence = "\x1B[5~" }});
|
||||
result.set(.kp_page_down, pcStyle("\x1b[6;{}~") ++ .{.{ .sequence = "\x1B[6~" }});
|
||||
|
||||
result.set(.backspace, &.{
|
||||
// Modify Keys Normal
|
||||
|
@@ -344,6 +344,18 @@ pub const Key = enum(c_int) {
|
||||
kp_add,
|
||||
kp_enter,
|
||||
kp_equal,
|
||||
kp_separator,
|
||||
kp_left,
|
||||
kp_right,
|
||||
kp_up,
|
||||
kp_down,
|
||||
kp_page_up,
|
||||
kp_page_down,
|
||||
kp_home,
|
||||
kp_end,
|
||||
kp_insert,
|
||||
kp_delete,
|
||||
kp_begin,
|
||||
|
||||
// modifiers
|
||||
left_shift,
|
||||
@@ -552,6 +564,20 @@ pub const Key = enum(c_int) {
|
||||
.kp_add => cimgui.c.ImGuiKey_KeypadAdd,
|
||||
.kp_enter => cimgui.c.ImGuiKey_KeypadEnter,
|
||||
.kp_equal => cimgui.c.ImGuiKey_KeypadEqual,
|
||||
// We map KP_SEPARATOR to Comma because traditionally a numpad would
|
||||
// have a numeric separator key. Most modern numpads do not
|
||||
.kp_separator => cimgui.c.ImGuiKey_Comma,
|
||||
.kp_left => cimgui.c.ImGuiKey_LeftArrow,
|
||||
.kp_right => cimgui.c.ImGuiKey_RightArrow,
|
||||
.kp_up => cimgui.c.ImGuiKey_UpArrow,
|
||||
.kp_down => cimgui.c.ImGuiKey_DownArrow,
|
||||
.kp_page_up => cimgui.c.ImGuiKey_PageUp,
|
||||
.kp_page_down => cimgui.c.ImGuiKey_PageUp,
|
||||
.kp_home => cimgui.c.ImGuiKey_Home,
|
||||
.kp_end => cimgui.c.ImGuiKey_End,
|
||||
.kp_insert => cimgui.c.ImGuiKey_Insert,
|
||||
.kp_delete => cimgui.c.ImGuiKey_Delete,
|
||||
.kp_begin => cimgui.c.ImGuiKey_NamedKey_BEGIN,
|
||||
|
||||
.left_shift => cimgui.c.ImGuiKey_LeftShift,
|
||||
.left_control => cimgui.c.ImGuiKey_LeftCtrl,
|
||||
|
@@ -104,6 +104,18 @@ const raw_entries: []const RawEntry = &.{
|
||||
.{ .kp_add, 57413, 'u', false },
|
||||
.{ .kp_enter, 57414, 'u', false },
|
||||
.{ .kp_equal, 57415, 'u', false },
|
||||
.{ .kp_separator, 57416, 'u', false },
|
||||
.{ .kp_left, 57417, 'u', false },
|
||||
.{ .kp_right, 57418, 'u', false },
|
||||
.{ .kp_up, 57419, 'u', false },
|
||||
.{ .kp_down, 57420, 'u', false },
|
||||
.{ .kp_page_up, 57421, 'u', false },
|
||||
.{ .kp_page_down, 57422, 'u', false },
|
||||
.{ .kp_home, 57423, 'u', false },
|
||||
.{ .kp_end, 57424, 'u', false },
|
||||
.{ .kp_insert, 57425, 'u', false },
|
||||
.{ .kp_delete, 57426, 'u', false },
|
||||
.{ .kp_begin, 57427, 'u', false },
|
||||
|
||||
.{ .left_shift, 57441, 'u', true },
|
||||
.{ .right_shift, 57447, 'u', true },
|
||||
|
Reference in New Issue
Block a user