From f0e2ef442f9b0d5430d436ac00419646497574c8 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 5 Nov 2025 21:33:04 +0100 Subject: [PATCH] feat: make `b` key in goto mini mode toggle goto byte offset mode --- src/keybind/builtin/flow.json | 2 +- src/tui/tui.zig | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/keybind/builtin/flow.json b/src/keybind/builtin/flow.json index 2480b15..8d861e7 100644 --- a/src/keybind/builtin/flow.json +++ b/src/keybind/builtin/flow.json @@ -428,7 +428,7 @@ }, "mini/numeric": { "press": [ - ["b", "goto_offset"], + ["b", "toggle_goto_style"], ["ctrl+q", "quit"], ["ctrl+v", "system_paste"], ["ctrl+u", "mini_mode_reset"], diff --git a/src/tui/tui.zig b/src/tui/tui.zig index a465633..5d72e4b 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -1185,6 +1185,17 @@ const cmds = struct { .arguments = &.{.integer}, }; + pub fn toggle_goto_style(self: *Self, ctx: Ctx) Result { + return if (self.mini_mode_) |mode| + if (std.mem.eql(u8, mode.name, "#goto byte")) + command.executeName("goto", ctx) + else + command.executeName("goto_offset", ctx) + else + command.executeName("goto", ctx); + } + pub const toggle_goto_style_meta: Meta = .{ .description = "Toggle goto byte offset mode" }; + pub fn move_to_char(self: *Self, ctx: Ctx) Result { return enter_mini_mode(self, @import("mode/mini/move_to_char.zig"), ctx); }