Add docs for performable

This commit is contained in:
Mitchell Hashimoto
2025-01-02 15:38:41 -08:00
parent f38d1585e8
commit 95b73f197f
3 changed files with 33 additions and 5 deletions

View File

@@ -37,8 +37,9 @@ pub const Flags = packed struct {
/// See the keybind config documentation for more information.
global: bool = false,
/// True if this binding can be performed then the action is
/// triggered otherwise it acts as if it doesn't exist.
/// True if this binding should only be triggered if the action can be
/// performed. If the action can't be performed then the binding acts as
/// if it doesn't exist.
performable: bool = false,
};
@@ -1654,6 +1655,16 @@ test "parse: triggers" {
.flags = .{ .consumed = false },
}, try parseSingle("unconsumed:physical:a+shift=ignore"));
// performable keys
try testing.expectEqual(Binding{
.trigger = .{
.mods = .{ .shift = true },
.key = .{ .translated = .a },
},
.action = .{ .ignore = {} },
.flags = .{ .performable = true },
}, try parseSingle("performable:shift+a=ignore"));
// invalid key
try testing.expectError(Error.InvalidFormat, parseSingle("foo=ignore"));