Make undo, cut, copy, paste keys mappable

This commit is contained in:
Max Guppy
2024-05-16 13:23:20 +10:00
parent cbcb4b27bc
commit 5f29762fd9
4 changed files with 26 additions and 0 deletions

View File

@ -252,6 +252,10 @@ typedef enum {
GHOSTTY_KEY_BACKSPACE,
GHOSTTY_KEY_PRINT_SCREEN,
GHOSTTY_KEY_PAUSE,
GHOSTTY_KEY_UNDO,
GHOSTTY_KEY_CUT,
GHOSTTY_KEY_COPY,
GHOSTTY_KEY_PASTE,
// function keys
GHOSTTY_KEY_F1,

View File

@ -1125,6 +1125,16 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
.{ .paste_from_clipboard = {} },
);
}
try result.keybind.set.put(
alloc,
.{ .key = .copy },
.{ .copy_to_clipboard = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .paste },
.{ .paste_from_clipboard = {} },
);
// Fonts
try result.keybind.set.put(

View File

@ -307,6 +307,10 @@ pub const Key = enum(c_int) {
backspace,
print_screen,
pause,
undo,
cut,
copy,
paste,
// function keys
f1,
@ -616,6 +620,10 @@ pub const Key = enum(c_int) {
// These keys aren't represented in cimgui
.plus,
.undo,
.cut,
.copy,
.paste,
=> null,
};
}

View File

@ -153,6 +153,10 @@ const code_to_key = code_to_key: {
.{ "Numpad0", .kp_0 },
.{ "NumpadDecimal", .kp_decimal },
.{ "NumpadEqual", .kp_equal },
.{ "Undo", .undo },
.{ "Cut", .cut },
.{ "Copy", .copy },
.{ "Paste", .paste },
.{ "ControlLeft", .left_control },
.{ "ShiftLeft", .left_shift },
.{ "AltLeft", .left_alt },