From 15b582243cf25215b9e544e67b96677848bb5b77 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:03:46 +0100 Subject: [PATCH 1/7] fix: ignore modifiers on all modifier keys This allows combining of modifier key event keybindings without having to bind all modifier combinations. ie. with this we can use fast_scroll and jump_mode at the same time by holding both modifiers down. --- src/keybind/keybind.zig | 3 +++ src/renderer/vaxis/input.zig | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/keybind/keybind.zig b/src/keybind/keybind.zig index 31d58d9..cd182f8 100644 --- a/src/keybind/keybind.zig +++ b/src/keybind/keybind.zig @@ -717,6 +717,9 @@ const BindingSet = struct { const mods = switch (key_event.key) { input.key.left_control, input.key.right_control => 0, input.key.left_alt, input.key.right_alt => 0, + input.key.left_shift, input.key.right_shift => 0, + input.key.left_super, input.key.right_super => 0, + input.key.iso_level_3_shift, input.key.iso_level_5_shift => 0, else => switch (mode_flag) { .ignore_alt_text_modifiers => if (std.mem.eql(u8, text, codepoint)) key_event.modifiers else 0, .normal => key_event.modifiers, diff --git a/src/renderer/vaxis/input.zig b/src/renderer/vaxis/input.zig index d357cc8..68098f9 100644 --- a/src/renderer/vaxis/input.zig +++ b/src/renderer/vaxis/input.zig @@ -126,10 +126,11 @@ pub const KeyEvent = struct { modifiers: Mods, ) @This() { const mods_ = switch (keypress_) { - key.left_super, key.right_super => modifiers & ~mod.super, - key.left_shift, key.right_shift => modifiers & ~mod.shift, - key.left_control, key.right_control => modifiers & ~mod.ctrl, - key.left_alt, key.right_alt => modifiers & ~mod.alt, + key.left_control, key.right_control => 0, + key.left_alt, key.right_alt => 0, + key.left_shift, key.right_shift => 0, + key.left_super, key.right_super => 0, + key.iso_level_3_shift, key.iso_level_5_shift => 0, else => modifiers, }; From 7c0d841bb6845434e2895d8f20b8b6a22d48dc42 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:05:52 +0100 Subject: [PATCH 2/7] refactor: add enable/disalb_alt_scroll keybinds to flow mode --- src/keybind/builtin/flow.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/keybind/builtin/flow.json b/src/keybind/builtin/flow.json index 5602631..5e1797d 100644 --- a/src/keybind/builtin/flow.json +++ b/src/keybind/builtin/flow.json @@ -255,13 +255,17 @@ ["left_control", "enable_jump_mode"], ["right_control", "enable_jump_mode"], ["left_alt", "enable_fast_scroll"], - ["right_alt", "enable_fast_scroll"] + ["right_alt", "enable_fast_scroll"], + ["left_shift", "enable_alt_scroll"], + ["right_shift", "enable_alt_scroll"] ], "release": [ ["left_control", "disable_jump_mode"], ["right_control", "disable_jump_mode"], ["left_alt", "disable_fast_scroll"], - ["right_alt", "disable_fast_scroll"] + ["right_alt", "disable_fast_scroll"], + ["left_shift", "disable_alt_scroll"], + ["right_shift", "disable_alt_scroll"] ] }, "select": { From 961b88ffd5740b13604e04e776b73435f4428fa4 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:06:48 +0100 Subject: [PATCH 3/7] refactor: do not report missing commands for alt_scroll mode bindings --- src/command.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/command.zig b/src/command.zig index 6991794..0a23742 100644 --- a/src/command.zig +++ b/src/command.zig @@ -207,6 +207,8 @@ pub fn get_icon(id: ID) ?[]const u8 { const suppressed_errors = std.StaticStringMap(void).initComptime(.{ .{ "enable_fast_scroll", void }, .{ "disable_fast_scroll", void }, + .{ "enable_alt_scroll", void }, + .{ "disable_alt_scroll", void }, .{ "clear_diagnostics", void }, .{ "palette_menu_cancel", void }, }); From a53ef127ec882d630761fe3f96b9dfe0b908d753 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:08:17 +0100 Subject: [PATCH 4/7] feat: add fast_scroll mode support to horizontal scrolling Also, bump the basic scroll step to 5 columns like other editors. --- src/buffer/View.zig | 12 +++++++----- src/tui/editor.zig | 12 ++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/buffer/View.zig b/src/buffer/View.zig index c6579ad..a11e54e 100644 --- a/src/buffer/View.zig +++ b/src/buffer/View.zig @@ -29,14 +29,16 @@ pub inline fn eql(self: Self, other: Self) bool { return self.row == other.row and self.col == other.col and self.rows == other.rows and self.cols == other.cols; } -pub fn move_left(self: *Self) !void { - if (self.col > 0) { - self.col -= 1; +pub fn move_left(self: *Self, n: usize) error{Stop}!void { + if (self.col > n) { + self.col -= n; + } else if (self.col > 0) { + self.col = 0; } else return error.Stop; } -pub fn move_right(self: *Self) !void { - self.col += 1; +pub fn move_right(self: *Self, n: usize) error{Stop}!void { + self.col += n; } pub fn move_up(self: *Self) !void { diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 712392d..e126bbc 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -37,6 +37,8 @@ const Allocator = std.mem.Allocator; const time = std.time; const scroll_step_small = 3; +const scroll_step_horizontal = 5; +const scroll_step_horizontal_fast = scroll_step_horizontal * 5; const scroll_cursor_min_border_distance = 5; const double_click_time_ms = 350; @@ -4150,12 +4152,18 @@ pub const Editor = struct { pub const move_scroll_down_meta: Meta = .{ .description = "Move and scroll down", .arguments = &.{.integer} }; pub fn move_scroll_left(self: *Self, _: Context) Result { - self.view.move_left() catch {}; + if (self.fast_scroll) + self.view.move_left(scroll_step_horizontal_fast) catch {} + else + self.view.move_left(scroll_step_horizontal) catch {}; } pub const move_scroll_left_meta: Meta = .{ .description = "Scroll left" }; pub fn move_scroll_right(self: *Self, _: Context) Result { - self.view.move_right() catch {}; + if (self.fast_scroll) + self.view.move_right(scroll_step_horizontal_fast) catch {} + else + self.view.move_right(scroll_step_horizontal) catch {}; } pub const move_scroll_right_meta: Meta = .{ .description = "Scroll right" }; From 385478741faff88e2dde3d711c16431008be39c9 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:10:02 +0100 Subject: [PATCH 5/7] refactor: reset alt_scroll mode on mode change --- src/tui/tui.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 5bf75e1..e2eb219 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -882,6 +882,7 @@ pub fn is_mainview_focused() bool { fn enter_overlay_mode(self: *Self, mode: type) command.Result { command.executeName("disable_fast_scroll", .{}) catch {}; + command.executeName("disable_alt_scroll", .{}) catch {}; command.executeName("disable_jump_mode", .{}) catch {}; if (self.mini_mode_) |_| try cmds.exit_mini_mode(self, .{}); if (self.input_mode_outer_) |_| try cmds.exit_overlay_mode(self, .{}); @@ -894,6 +895,7 @@ fn enter_overlay_mode(self: *Self, mode: type) command.Result { fn enter_overlay_mode_with_args(self: *Self, mode: type, ctx: command.Context) command.Result { command.executeName("disable_fast_scroll", .{}) catch {}; + command.executeName("disable_alt_scroll", .{}) catch {}; command.executeName("disable_jump_mode", .{}) catch {}; if (self.mini_mode_) |_| try cmds.exit_mini_mode(self, .{}); if (self.input_mode_outer_) |_| try cmds.exit_overlay_mode(self, .{}); @@ -1469,6 +1471,7 @@ const cmds = struct { fn enter_mini_mode(self: *Self, comptime mode: anytype, ctx: Ctx) !void { command.executeName("disable_fast_scroll", .{}) catch {}; + command.executeName("disable_alt_scroll", .{}) catch {}; command.executeName("disable_jump_mode", .{}) catch {}; if (self.mini_mode_) |_| try exit_mini_mode(self, .{}); if (self.input_mode_outer_) |_| try exit_overlay_mode(self, .{}); From 6828b24367e46a8367b0c62d2ae7820431e2d2f2 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:10:46 +0100 Subject: [PATCH 6/7] feat: add enable/disable_alt_scroll commands --- src/tui/editor.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index e126bbc..72ed088 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -373,6 +373,7 @@ pub const Editor = struct { handlers: EventHandler.List, scroll_dest: usize = 0, fast_scroll: bool = false, + alt_scroll: bool = false, jump_mode: bool = false, animation_step: usize = 0, @@ -5098,6 +5099,16 @@ pub const Editor = struct { } pub const disable_fast_scroll_meta: Meta = .{}; + pub fn enable_alt_scroll(self: *Self, _: Context) Result { + self.alt_scroll = true; + } + pub const enable_alt_scroll_meta: Meta = .{ .description = "Enable horizontal scroll mode" }; + + pub fn disable_alt_scroll(self: *Self, _: Context) Result { + self.alt_scroll = false; + } + pub const disable_alt_scroll_meta: Meta = .{}; + pub fn enable_jump_mode(self: *Self, _: Context) Result { self.jump_mode = true; tui.rdr().request_mouse_cursor_pointer(true); From 1dc0fcf9b5a915d221e67333300d391264bdbc21 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 11:11:19 +0100 Subject: [PATCH 7/7] feat: scroll editor horizontally when in alt scroll mode --- src/tui/editor.zig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 72ed088..37b6a18 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -2794,16 +2794,20 @@ pub const Editor = struct { self.update_scroll_dest_abs(dest.row); } - pub fn scroll_up_pageup(self: *Self, _: Context) Result { - if (self.fast_scroll) + pub fn scroll_up_pageup(self: *Self, ctx: Context) Result { + if (self.alt_scroll) + try self.move_scroll_left(ctx) + else if (self.fast_scroll) self.scroll_pageup() else self.scroll_up(); } pub const scroll_up_pageup_meta: Meta = .{}; - pub fn scroll_down_pagedown(self: *Self, _: Context) Result { - if (self.fast_scroll) + pub fn scroll_down_pagedown(self: *Self, ctx: Context) Result { + if (self.alt_scroll) + try self.move_scroll_right(ctx) + else if (self.fast_scroll) self.scroll_pagedown() else self.scroll_down();