hook up more control keys: home, end, page up, page down

This commit is contained in:
Mitchell Hashimoto
2022-08-24 11:16:36 -07:00
parent 80376ce6da
commit 3b5a9caff5
4 changed files with 12 additions and 2 deletions

View File

@ -27,8 +27,6 @@ Improvements:
* double-click to select a word
* triple-click to select a line
* shift-click and drag to continue selection
* arrow keys do nothing, should send proper codes
* home/end should scroll to top/bottom of scrollback
Major Features:

View File

@ -534,6 +534,10 @@ fn keyCallback(
.down => .down,
.right => .right,
.left => .left,
.home => .home,
.end => .end,
.page_up => .page_up,
.page_down => .page_down,
else => .invalid,
},
};

View File

@ -92,6 +92,10 @@ pub const Config = struct {
try result.keybind.set.put(alloc, .{ .key = .down }, .{ .csi = "B" });
try result.keybind.set.put(alloc, .{ .key = .right }, .{ .csi = "C" });
try result.keybind.set.put(alloc, .{ .key = .left }, .{ .csi = "D" });
try result.keybind.set.put(alloc, .{ .key = .home }, .{ .csi = "H" });
try result.keybind.set.put(alloc, .{ .key = .end }, .{ .csi = "F" });
try result.keybind.set.put(alloc, .{ .key = .page_up }, .{ .csi = "5~" });
try result.keybind.set.put(alloc, .{ .key = .page_down }, .{ .csi = "6~" });
return result;
}

View File

@ -54,6 +54,10 @@ pub const Key = enum {
down,
right,
left,
home,
end,
page_up,
page_down,
// To support more keys (there are obviously more!) add them here
// and ensure the mapping is up to date in the Window key handler.