Skip to content

Commit

Permalink
Extend textobject selections in select mode
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Jul 30, 2022
1 parent 73ecf6c commit 9c5f716
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4226,16 +4226,24 @@ fn goto_ts_object_impl(cx: &mut Context, object: &'static str, direction: Direct
let root = syntax.tree().root_node();

let selection = doc.selection(view.id).clone().transform(|range| {
movement::goto_treesitter_object(
let new_range = movement::goto_treesitter_object(
text,
range,
object,
direction,
root,
lang_config,
count,
)
.with_direction(direction)
);

if doc.mode == Mode::Select {
Range::new(
range.anchor,
new_range.with_direction(range.direction()).head,
)
} else {
new_range.with_direction(direction)
}
});

doc.set_selection(view.id, selection);
Expand Down

0 comments on commit 9c5f716

Please sign in to comment.