Skip to content

Commit 9c5f716

Browse files
committed
Extend textobject selections in select mode
1 parent 73ecf6c commit 9c5f716

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

helix-term/src/commands.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,16 +4226,24 @@ fn goto_ts_object_impl(cx: &mut Context, object: &'static str, direction: Direct
42264226
let root = syntax.tree().root_node();
42274227

42284228
let selection = doc.selection(view.id).clone().transform(|range| {
4229-
movement::goto_treesitter_object(
4229+
let new_range = movement::goto_treesitter_object(
42304230
text,
42314231
range,
42324232
object,
42334233
direction,
42344234
root,
42354235
lang_config,
42364236
count,
4237-
)
4238-
.with_direction(direction)
4237+
);
4238+
4239+
if doc.mode == Mode::Select {
4240+
Range::new(
4241+
range.anchor,
4242+
new_range.with_direction(range.direction()).head,
4243+
)
4244+
} else {
4245+
new_range.with_direction(direction)
4246+
}
42394247
});
42404248

42414249
doc.set_selection(view.id, selection);

0 commit comments

Comments
 (0)