From 1d38bc36d346661321b022476b037b6b47fbd734 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 1 Dec 2025 21:33:10 +0100 Subject: [PATCH] feat: add command to toggle keybind hint mode --- src/tui/tui.zig | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 3bfeab2..9c161fb 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -84,6 +84,9 @@ clipboard: ?std.ArrayList(ClipboardEntry) = null, clipboard_current_group_number: usize = 0, color_scheme: enum { dark, light } = .dark, color_scheme_locked: bool = false, +hint_mode: HintMode = .prefix, + +const HintMode = enum { none, prefix, all }; pub const ClipboardEntry = struct { text: []const u8 = &.{}, @@ -561,7 +564,11 @@ fn render(self: *Self) void { self.rdr_.stdplane().erase(); const continue_mainview = if (self.mainview_) |mv| mv.render(self.current_theme()) else false; - @import("keyhints.zig").render_current_key_event_sequence(self.allocator, self.current_theme()); + switch (self.hint_mode) { + .prefix => @import("keyhints.zig").render_current_key_event_sequence(self.allocator, .no_keypad, self.current_theme()), + .all => @import("keyhints.zig").render_current_input_mode(self.allocator, .no_keypad, self.current_theme()), + .none => {}, + } break :ret continue_mainview; }; @@ -1042,6 +1049,14 @@ const cmds = struct { } pub const toggle_centered_view_meta: Meta = .{ .description = "Toggle centered view" }; + pub fn toggle_keybind_hints(self: *Self, _: Ctx) Result { + self.hint_mode = switch (self.hint_mode) { + .all => .prefix, + else => .all, + }; + } + pub const toggle_keybind_hints_meta: Meta = .{ .description = "Toggle keybind hints" }; + pub fn force_color_scheme(self: *Self, ctx: Ctx) Result { self.force_color_scheme(if (try ctx.args.match(.{"dark"})) .dark