mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
input: global/all bindings can't be sequenced
This commit is contained in:
@ -704,6 +704,9 @@ class: ?[:0]const u8 = null,
|
|||||||
/// `ctrl+a>t`, and then bind `ctrl+a` directly, both `ctrl+a>n` and
|
/// `ctrl+a>t`, and then bind `ctrl+a` directly, both `ctrl+a>n` and
|
||||||
/// `ctrl+a>t` will become unbound.
|
/// `ctrl+a>t` will become unbound.
|
||||||
///
|
///
|
||||||
|
/// * Trigger sequences are not allowed for `global:` or `all:`-prefixed
|
||||||
|
/// triggers. This is a limitation we could remove in the future.
|
||||||
|
///
|
||||||
/// Action is the action to take when the trigger is satisfied. It takes the
|
/// Action is the action to take when the trigger is satisfied. It takes the
|
||||||
/// format `action` or `action:param`. The latter form is only valid if the
|
/// format `action` or `action:param`. The latter form is only valid if the
|
||||||
/// action requires a parameter.
|
/// action requires a parameter.
|
||||||
@ -762,7 +765,10 @@ class: ?[:0]const u8 = null,
|
|||||||
/// any) will not be sent to the running program in the terminal. If
|
/// any) will not be sent to the running program in the terminal. If
|
||||||
/// you wish to send the encoded value to the program, specify the
|
/// you wish to send the encoded value to the program, specify the
|
||||||
/// `unconsumed:` prefix before the entire keybind. For example:
|
/// `unconsumed:` prefix before the entire keybind. For example:
|
||||||
/// `unconsumed:ctrl+a=reload_config`
|
/// `unconsumed:ctrl+a=reload_config`. `global:` and `all:`-prefixed
|
||||||
|
/// keybinds will always consume the input regardless of this setting.
|
||||||
|
/// Since they are not associated with a specific terminal surface,
|
||||||
|
/// they're never encoded.
|
||||||
///
|
///
|
||||||
/// Multiple prefixes can be specified. For example,
|
/// Multiple prefixes can be specified. For example,
|
||||||
/// `global:unconsumed:ctrl+a=reload_config` will make the keybind global
|
/// `global:unconsumed:ctrl+a=reload_config` will make the keybind global
|
||||||
|
@ -109,7 +109,11 @@ pub const Parser = struct {
|
|||||||
const trigger = (try self.trigger_it.next()) orelse return null;
|
const trigger = (try self.trigger_it.next()) orelse return null;
|
||||||
|
|
||||||
// If this is our last trigger then it is our final binding.
|
// If this is our last trigger then it is our final binding.
|
||||||
if (!self.trigger_it.done()) return .{ .leader = trigger };
|
if (!self.trigger_it.done()) {
|
||||||
|
// Global/all bindings can't be sequences
|
||||||
|
if (self.flags.global or self.flags.all) return error.InvalidFormat;
|
||||||
|
return .{ .leader = trigger };
|
||||||
|
}
|
||||||
|
|
||||||
// Out of triggers, yield the final action.
|
// Out of triggers, yield the final action.
|
||||||
return .{ .binding = .{
|
return .{ .binding = .{
|
||||||
@ -1342,6 +1346,12 @@ test "parse: global triggers" {
|
|||||||
.consumed = false,
|
.consumed = false,
|
||||||
},
|
},
|
||||||
}, try parseSingle("unconsumed:global:a+shift=ignore"));
|
}, try parseSingle("unconsumed:global:a+shift=ignore"));
|
||||||
|
|
||||||
|
// global sequences not allowed
|
||||||
|
{
|
||||||
|
var p = try Parser.init("global:a>b=ignore");
|
||||||
|
try testing.expectError(Error.InvalidFormat, p.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test "parse: modifier aliases" {
|
test "parse: modifier aliases" {
|
||||||
|
Reference in New Issue
Block a user