From bfa3ea007c443adfc8906d79c92570158177e232 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 25 Sep 2025 10:55:33 +0200 Subject: [PATCH 1/4] feat: make shrink_selection select the node at the cursor if there is no selection --- src/tui/editor.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 8252578..f38f71d 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4386,11 +4386,12 @@ pub const Editor = struct { const root = try self.buf_root(); const cursel = self.get_primary(); cursel.check_selection(root, self.metrics); - if (cursel.selection) |_| + if (cursel.selection) |_| { try if (unnamed) self.shrink_selection_to_child_node(root, cursel, self.metrics) else self.shrink_selection_to_named_child_node(root, cursel, self.metrics); + } else try cursel.select_node(try self.top_node_at_cursel(cursel, root, self.metrics), root, self.metrics); self.clamp(); try self.send_editor_jump_destination(); } From 203f05fef77f4024f3fc8b8bf6897220e5ac0197 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 25 Sep 2025 10:56:16 +0200 Subject: [PATCH 2/4] feat: make select_next_sibling select the node at the cursor if there is no selection --- src/tui/editor.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index f38f71d..1c4febb 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4420,10 +4420,12 @@ pub const Editor = struct { const root = try self.buf_root(); const cursel = self.get_primary(); cursel.check_selection(root, self.metrics); - try if (unnamed) - self.select_next_sibling_node(root, cursel, self.metrics) - else - self.select_next_named_sibling_node(root, cursel, self.metrics); + if (cursel.selection) |_| { + try if (unnamed) + self.select_next_sibling_node(root, cursel, self.metrics) + else + self.select_next_named_sibling_node(root, cursel, self.metrics); + } else try cursel.select_node(try self.top_node_at_cursel(cursel, root, self.metrics), root, self.metrics); self.clamp(); try self.send_editor_jump_destination(); } From 6c385bc35a434349b2e4b939805291187d4ee827 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 25 Sep 2025 14:55:57 +0200 Subject: [PATCH 3/4] fix: missing padding in buffer_palette --- src/tui/mode/overlay/buffer_palette.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tui/mode/overlay/buffer_palette.zig b/src/tui/mode/overlay/buffer_palette.zig index ee58850..066c16c 100644 --- a/src/tui/mode/overlay/buffer_palette.zig +++ b/src/tui/mode/overlay/buffer_palette.zig @@ -34,7 +34,7 @@ pub fn load_entries(palette: *Type) !usize { .indicator = indicator, }; } - return if (palette.entries.items.len == 0) label.len else 4; + return if (palette.entries.items.len == 0) label.len + 3 else 4; } pub fn clear_entries(palette: *Type) void { From 7c49138eac899966a650d79ccc33f9dfc348b6ea Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 25 Sep 2025 14:56:26 +0200 Subject: [PATCH 4/4] feat: add `:qa!` aliase for `quit_without_saving` in vim mode --- src/tui/mode/vim.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tui/mode/vim.zig b/src/tui/mode/vim.zig index 81839b9..9cefd76 100644 --- a/src/tui/mode/vim.zig +++ b/src/tui/mode/vim.zig @@ -35,6 +35,11 @@ const cmds_ = struct { } pub const @"q!_meta": Meta = .{ .description = "q! (quit without saving)" }; + pub fn @"qa!"(_: *void, _: Ctx) Result { + try cmd("quit_without_saving", .{}); + } + pub const @"qa!_meta": Meta = .{ .description = "qa! (quit without saving anything)" }; + pub fn wq(_: *void, _: Ctx) Result { try cmd("save_file", command.fmt(.{ "then", .{ "quit", .{} } })); }