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