feat: make select_next_sibling select the node at the cursor if there is no selection

This commit is contained in:
CJ van den Berg 2025-09-25 10:56:16 +02:00
parent bfa3ea007c
commit 203f05fef7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -4420,10 +4420,12 @@ pub const Editor = struct {
const root = try self.buf_root(); const root = try self.buf_root();
const cursel = self.get_primary(); const cursel = self.get_primary();
cursel.check_selection(root, self.metrics); cursel.check_selection(root, self.metrics);
try if (unnamed) if (cursel.selection) |_| {
self.select_next_sibling_node(root, cursel, self.metrics) try if (unnamed)
else self.select_next_sibling_node(root, cursel, self.metrics)
self.select_next_named_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(); self.clamp();
try self.send_editor_jump_destination(); try self.send_editor_jump_destination();
} }