feat: keybind escape sequence action "esc:text" similar to "csi:text"

This commit is contained in:
Leo Razoumov
2023-11-02 17:50:17 -04:00
parent cc6985d62d
commit dc527bd2cb
4 changed files with 20 additions and 5 deletions

View File

@@ -117,6 +117,9 @@ pub const Action = union(enum) {
/// without the CSI header ("ESC ]" or "\x1b]").
csi: []const u8,
/// Send an ESC sequence.
esc: []const u8,
/// Send data to the pty depending on whether cursor key mode is
/// enabled ("application") or disabled ("normal").
cursor_key: CursorKey,
@@ -665,6 +668,12 @@ test "parse: action with string" {
try testing.expect(binding.action == .csi);
try testing.expectEqualStrings("A", binding.action.csi);
}
// parameter
{
const binding = try parse("a=esc:A");
try testing.expect(binding.action == .esc);
try testing.expectEqualStrings("A", binding.action.esc);
}
}
test "parse: action with enum" {