refactor(terminal): add merged move_tab_next/prev_or_scroll_terminal_down/up commands

This commit is contained in:
CJ van den Berg 2026-02-26 21:18:28 +01:00
parent 8a3cd776e9
commit 885c9682eb
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 20 additions and 4 deletions

View file

@ -40,8 +40,6 @@
["ctrl+shift+f", "find_in_files"],
["ctrl+shift+l", "toggle_panel"],
["alt+shift+p", "open_command_palette"],
["ctrl+shift+page_up", "terminal_scroll_up"],
["ctrl+shift+page_down", "terminal_scroll_down"],
["alt+n", "goto_next_file_or_diagnostic"],
["alt+p", "goto_prev_file_or_diagnostic"],
["alt+l", "toggle_panel"],
@ -65,8 +63,8 @@
["ctrl+shift+tab", "previous_tab"],
["ctrl+page_down", "next_tab"],
["ctrl+page_up", "previous_tab"],
["ctrl+shift+page_down", "move_tab_next"],
["ctrl+shift+page_up", "move_tab_previous"],
["ctrl+shift+page_down", "move_tab_next_or_scroll_terminal_down"],
["ctrl+shift+page_up", "move_tab_previous_or_scroll_terminal_up"],
["ctrl+k e", "switch_buffers"],
["alt+shift+v", "clipboard_history"],
["ctrl+0", "reset_fontsize"],
@ -600,6 +598,8 @@
["ctrl+8", "focus_split", 7],
["ctrl+`", "focus_terminal"],
["ctrl+j", "toggle_panel"],
["ctrl+shift+page_down", "terminal_scroll_down"],
["ctrl+shift+page_up", "terminal_scroll_up"],
["ctrl+shift+j", "toggle_maximize_panel"],
["ctrl+shift+p", "open_command_palette"],
["alt+shift+p", "open_command_palette"],

View file

@ -1591,6 +1591,22 @@ const cmds = struct {
}
pub const move_tab_previous_meta: Meta = .{ .description = "Move tab to previous position" };
pub fn move_tab_next_or_scroll_terminal_down(self: *Self, _: Ctx) Result {
if (self.is_panel_view_showing(terminal_view))
try command.executeName("terminal_scroll_down", .{})
else
_ = try self.widgets_widget.msg(.{"move_tab_next"});
}
pub const move_tab_next_or_scroll_terminal_down_meta: Meta = .{ .description = "Move tab next or scroll terminal down" };
pub fn move_tab_previous_or_scroll_terminal_up(self: *Self, _: Ctx) Result {
if (self.is_panel_view_showing(terminal_view))
try command.executeName("terminal_scroll_up", .{})
else
_ = try self.widgets_widget.msg(.{"move_tab_previous"});
}
pub const move_tab_previous_or_scroll_terminal_up_meta: Meta = .{ .description = "Move tab previous or scroll terminal up" };
pub fn place_next_tab(self: *Self, ctx: Ctx) Result {
var pos: enum { before, after } = undefined;
var buffer_ref: Buffer.Ref = undefined;