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] 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(); }