fix: check if tree-sitter Node.getParent() returns a null node in expand_selection

closes #360
This commit is contained in:
CJ van den Berg 2025-11-05 13:55:22 +01:00
parent 0f7a4f25e4
commit 9a961c8dd2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -4363,6 +4363,8 @@ pub const Editor = struct {
while (parent_sel.eql(node_sel)) {
node = parent;
parent = parent.getParent();
if (parent.tree == null)
return node;
parent_sel = CurSel.selection_from_node(parent, root, metrics) catch return node;
}
return node;