expand_selection to current node with no children (#1454)

This commit is contained in:
Michael Davis 2022-01-08 09:31:05 -06:00 committed by GitHub
parent 5b45bdd80f
commit 939261fc07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ pub fn expand_selection(syntax: &Syntax, text: RopeSlice, selection: &Selection)
.root_node()
.descendant_for_byte_range(from, to)
.and_then(|node| {
if node.child_count() == 0 || (node.start_byte() == from && node.end_byte() == to) {
if node.start_byte() == from && node.end_byte() == to {
node.parent()
} else {
Some(node)