summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/keys.zig')
-rw-r--r--src/keys.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/keys.zig b/src/keys.zig
index 9496d37a..1329de0b 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -424,6 +424,14 @@ pub fn handleKey(p: *Pardes, key: Key) void {
}
}
+/// Whether a leader path `keys` is the core's, or begins one of its
+/// paths or is begun by one: a kind's word may not have it (Kind.zig).
+pub fn leaderTaken(keys: []const u8) bool {
+ for (config.leader_args) |la| if (std.mem.startsWith(u8, la.path, keys) or std.mem.startsWith(u8, keys, la.path)) return true;
+ for (builtin_rows) |row| if (row.path) |path| if (std.mem.startsWith(u8, path, keys) or std.mem.startsWith(u8, keys, path)) return true;
+ return keys.len > 0 and keys[0] == config.leader_help;
+}
+
fn leaderKey(p: *Pardes, key: Key) void {
p.prefix = .none; // only "still a prefix" below re-arms it
if (key.ctrl or key.alt or key.cp < 0x20 or key.cp > 0x7e) return;