feat: add scroll_keybind_hints command
This commit is contained in:
parent
a296471161
commit
3012fdcd90
3 changed files with 20 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ const Widget = @import("Widget.zig");
|
|||
|
||||
const widget_type: Widget.Type = .hint_window;
|
||||
|
||||
var show_page: usize = 0;
|
||||
|
||||
pub fn render_current_input_mode(allocator: std.mem.Allocator, select_mode: keybind.SelectMode, theme: *const Widget.Theme) void {
|
||||
const mode = tui.input_mode() orelse return;
|
||||
const bindings = blk: {
|
||||
|
|
@ -25,9 +27,13 @@ pub fn render_current_key_event_sequence(allocator: std.mem.Allocator, select_mo
|
|||
return render(bindings, theme, .no_key_event_prefix);
|
||||
}
|
||||
|
||||
pub fn scroll() void {
|
||||
show_page += 1;
|
||||
}
|
||||
|
||||
const RenderMode = enum { full, no_key_event_prefix };
|
||||
|
||||
pub fn render(bindings: []const keybind.Binding, theme: *const Widget.Theme, mode: RenderMode) void {
|
||||
fn render(bindings: []const keybind.Binding, theme: *const Widget.Theme, mode: RenderMode) void {
|
||||
// return if something is already rendering to the top layer
|
||||
if (tui.have_top_layer()) return;
|
||||
if (bindings.len == 0) return;
|
||||
|
|
|
|||
|
|
@ -1057,6 +1057,11 @@ const cmds = struct {
|
|||
}
|
||||
pub const toggle_keybind_hints_meta: Meta = .{ .description = "Toggle keybind hints" };
|
||||
|
||||
pub fn scroll_keybind_hints(_: *Self, _: Ctx) Result {
|
||||
@import("keyhints.zig").scroll();
|
||||
}
|
||||
pub const scroll_keybind_hints_meta: Meta = .{ .description = "Scroll keybind hints" };
|
||||
|
||||
pub fn force_color_scheme(self: *Self, ctx: Ctx) Result {
|
||||
self.force_color_scheme(if (try ctx.args.match(.{"dark"}))
|
||||
.dark
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue