Merge branch 'terminal' into wio-sokol-gui

This commit is contained in:
CJ van den Berg 2026-04-03 22:43:14 +02:00
commit 0564673946
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
26 changed files with 1247 additions and 77 deletions

View file

@ -23,7 +23,9 @@
["ctrl+6", "focus_split", 5],
["ctrl+7", "focus_split", 6],
["ctrl+8", "focus_split", 7],
["ctrl+`", "open_terminal"],
["ctrl+j", "toggle_panel"],
["ctrl+shift+j", "toggle_maximize_panel"],
["ctrl+q", "quit"],
["ctrl+w", "close_split"],
["ctrl+o", "open_file"],
@ -61,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"],
@ -351,6 +353,7 @@
["alt+f9", "overlay_next_widget_style"],
["alt+!", "add_task"],
["ctrl+j", "toggle_panel"],
["ctrl+shift+j", "toggle_maximize_panel"],
["ctrl+q", "quit"],
["ctrl+w", "close_file"],
["ctrl+shift+f", "find_in_files"],
@ -519,6 +522,7 @@
["shift+f1", "scroll_keybind_hints"],
["ctrl+alt+?", "scroll_keybind_hints"],
["alt+f9", "panel_next_widget_style"],
["ctrl+shift+j", "toggle_maximize_panel"],
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
@ -583,5 +587,30 @@
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
},
"terminal": {
"on_match_failure": "nothing",
"press": [
["ctrl+1", "focus_split", 0],
["ctrl+2", "focus_split", 1],
["ctrl+3", "focus_split", 2],
["ctrl+4", "focus_split", 3],
["ctrl+5", "focus_split", 4],
["ctrl+6", "focus_split", 5],
["ctrl+7", "focus_split", 6],
["ctrl+8", "focus_split", 7],
["ctrl+`", "unfocus_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"],
["alt+x", "open_command_palette"],
["alt+!", "run_task"],
["alt+f9", "panel_next_widget_style"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+alt+shift+r", "restart"]
]
}
}

View file

@ -485,7 +485,7 @@ const BindingSet = struct {
deinit_command: ?Command = null,
const KeySyntax = enum { flow, vim };
const OnMatchFailure = enum { insert, ignore };
const OnMatchFailure = enum { insert, ignore, nothing };
fn load(allocator: std.mem.Allocator, namespace_name: []const u8, config_section: []const u8, mode_bindings: std.json.Value, fallback: ?*const BindingSet, namespace: *Namespace) (error{ OutOfMemory, WriteFailed } || parse_flow.ParseError || parse_vim.ParseError || std.json.ParseFromValueError)!@This() {
var self: @This() = .{ .name = undefined, .config_section = config_section, .selection_style = undefined };
@ -667,7 +667,7 @@ const BindingSet = struct {
}
}
fn receive(self: *const @This(), _: tp.pid_ref, m: tp.message) error{Exit}!bool {
pub fn receive(self: *const @This(), _: tp.pid_ref, m: tp.message) error{Exit}!bool {
var event: input.Event = 0;
var keypress: input.Key = 0;
var keypress_shifted: input.Key = 0;
@ -696,6 +696,7 @@ const BindingSet = struct {
}
for (binding.commands) |*cmd| try cmd.execute();
return true;
}
} else if (try m.match(.{"F"})) {
self.flush() catch |e| return tp.exit_error(e, @errorReturnTrace());
@ -786,6 +787,7 @@ const BindingSet = struct {
else
log_keyhints_message(),
.ignore => log_keyhints_message(),
.nothing => {},
}
globals.current_sequence.clearRetainingCapacity();
globals.current_sequence_egc.clearRetainingCapacity();