mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
Extend textobject selections in select mode
This commit is contained in:
parent
032d76ccf2
commit
c253139790
@ -4282,7 +4282,7 @@ 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,
|
||||
@ -4290,8 +4290,19 @@ fn goto_ts_object_impl(cx: &mut Context, object: &'static str, direction: Direct
|
||||
root,
|
||||
lang_config,
|
||||
count,
|
||||
)
|
||||
.with_direction(direction)
|
||||
);
|
||||
|
||||
if editor.mode == Mode::Select {
|
||||
let head = if new_range.head < range.anchor {
|
||||
new_range.anchor
|
||||
} else {
|
||||
new_range.head
|
||||
};
|
||||
|
||||
Range::new(range.anchor, head)
|
||||
} else {
|
||||
new_range.with_direction(direction)
|
||||
}
|
||||
});
|
||||
|
||||
doc.set_selection(view.id, selection);
|
||||
|
Loading…
Reference in New Issue
Block a user