feat: make b key in goto mini mode toggle goto byte offset mode

This commit is contained in:
CJ van den Berg 2025-11-05 21:33:04 +01:00
parent 477e232f19
commit f0e2ef442f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 12 additions and 1 deletions

View file

@ -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"],

View file

@ -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);
}