fix: disable fast scroll and/or jump mode when changing to mini/overlay modes

closes: #82
This commit is contained in:
CJ van den Berg 2024-12-17 17:15:41 +01:00
parent 3be04c0303
commit e17345eff7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -586,6 +586,8 @@ pub fn save_config(self: *const Self) !void {
} }
fn enter_overlay_mode(self: *Self, mode: type) command.Result { fn enter_overlay_mode(self: *Self, mode: type) command.Result {
command.executeName("disable_fast_scroll", .{}) catch {};
command.executeName("disable_jump_mode", .{}) catch {};
if (self.mini_mode) |_| try cmds.exit_mini_mode(self, .{}); if (self.mini_mode) |_| try cmds.exit_mini_mode(self, .{});
if (self.input_mode_outer) |_| try cmds.exit_overlay_mode(self, .{}); if (self.input_mode_outer) |_| try cmds.exit_overlay_mode(self, .{});
self.input_mode_outer = self.input_mode; self.input_mode_outer = self.input_mode;
@ -804,6 +806,8 @@ const cmds = struct {
pub const save_as_meta = .{ .description = "Save as" }; pub const save_as_meta = .{ .description = "Save as" };
fn enter_mini_mode(self: *Self, comptime mode: anytype, ctx: Ctx) !void { fn enter_mini_mode(self: *Self, comptime mode: anytype, ctx: Ctx) !void {
command.executeName("disable_fast_scroll", .{}) catch {};
command.executeName("disable_jump_mode", .{}) catch {};
const input_mode, const mini_mode = try mode.create(self.allocator, ctx); const input_mode, const mini_mode = try mode.create(self.allocator, ctx);
if (self.mini_mode) |_| try exit_mini_mode(self, .{}); if (self.mini_mode) |_| try exit_mini_mode(self, .{});
if (self.input_mode_outer) |_| try exit_overlay_mode(self, .{}); if (self.input_mode_outer) |_| try exit_overlay_mode(self, .{});