mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-20 04:27:21 +03:00
Add a check to prevent re-selecting same range (#2760)
This commit is contained in:
parent
d7bd441675
commit
3bd5545577
@ -3770,13 +3770,16 @@ fn expand_selection(cx: &mut Context) {
|
|||||||
let text = doc.text().slice(..);
|
let text = doc.text().slice(..);
|
||||||
|
|
||||||
let current_selection = doc.selection(view.id);
|
let current_selection = doc.selection(view.id);
|
||||||
|
let selection = object::expand_selection(syntax, text, current_selection.clone());
|
||||||
|
|
||||||
|
// check if selection is different from the last one
|
||||||
|
if *current_selection != selection {
|
||||||
// save current selection so it can be restored using shrink_selection
|
// save current selection so it can be restored using shrink_selection
|
||||||
view.object_selections.push(current_selection.clone());
|
view.object_selections.push(current_selection.clone());
|
||||||
|
|
||||||
let selection = object::expand_selection(syntax, text, current_selection.clone());
|
|
||||||
doc.set_selection(view.id, selection);
|
doc.set_selection(view.id, selection);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
motion(cx.editor);
|
motion(cx.editor);
|
||||||
cx.editor.last_motion = Some(Motion(Box::new(motion)));
|
cx.editor.last_motion = Some(Motion(Box::new(motion)));
|
||||||
|
Loading…
Reference in New Issue
Block a user