Take a mutable context when resolving selections (#19948)
This is a behavior-preserving change, but lays the groundwork for expanding selections when the cursor lands inside of a "replace" block. Release Notes: - N/A
This commit is contained in:
parent
83e2889d63
commit
c8003c0697
17 changed files with 288 additions and 257 deletions
|
@ -281,7 +281,7 @@ impl VimGlobals {
|
|||
&mut self,
|
||||
register: Option<char>,
|
||||
editor: Option<&mut Editor>,
|
||||
cx: &ViewContext<Editor>,
|
||||
cx: &mut ViewContext<Editor>,
|
||||
) -> Option<Register> {
|
||||
let Some(register) = register.filter(|reg| *reg != '"') else {
|
||||
let setting = VimSettings::get_global(cx).use_system_clipboard;
|
||||
|
|
|
@ -620,9 +620,11 @@ impl Vim {
|
|||
let Some(editor) = self.editor() else {
|
||||
return;
|
||||
};
|
||||
let newest_selection_empty = editor.update(cx, |editor, cx| {
|
||||
editor.selections.newest::<usize>(cx).is_empty()
|
||||
});
|
||||
let editor = editor.read(cx);
|
||||
let editor_mode = editor.mode();
|
||||
let newest_selection_empty = editor.selections.newest::<usize>(cx).is_empty();
|
||||
|
||||
if editor_mode == EditorMode::Full
|
||||
&& !newest_selection_empty
|
||||
|
@ -717,11 +719,12 @@ impl Vim {
|
|||
globals.recorded_count = None;
|
||||
|
||||
let selections = self.editor().map(|editor| {
|
||||
let editor = editor.read(cx);
|
||||
(
|
||||
editor.selections.oldest::<Point>(cx),
|
||||
editor.selections.newest::<Point>(cx),
|
||||
)
|
||||
editor.update(cx, |editor, cx| {
|
||||
(
|
||||
editor.selections.oldest::<Point>(cx),
|
||||
editor.selections.newest::<Point>(cx),
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
if let Some((oldest, newest)) = selections {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue