vim: Command selection fixes (#18424)
Release Notes: - vim: Fixed cursor position after `:{range}yank`. - vim: Added `:fo[ld]`, `:foldo[pen]` and `:foldc[lose]`
This commit is contained in:
parent
6d4ecac610
commit
ffd1083cc1
5 changed files with 220 additions and 104 deletions
|
@ -63,12 +63,7 @@ pub fn register(editor: &mut Editor, cx: &mut ViewContext<Vim>) {
|
|||
vim.record_current_action(cx);
|
||||
vim.visual_delete(true, cx);
|
||||
});
|
||||
Vim::action(editor, cx, |vim, _: &VisualYank, cx| {
|
||||
vim.visual_yank(false, cx)
|
||||
});
|
||||
Vim::action(editor, cx, |vim, _: &VisualYankLine, cx| {
|
||||
vim.visual_yank(true, cx)
|
||||
});
|
||||
Vim::action(editor, cx, |vim, _: &VisualYank, cx| vim.visual_yank(cx));
|
||||
|
||||
Vim::action(editor, cx, Vim::select_next);
|
||||
Vim::action(editor, cx, Vim::select_previous);
|
||||
|
@ -483,11 +478,10 @@ impl Vim {
|
|||
self.switch_mode(Mode::Normal, true, cx);
|
||||
}
|
||||
|
||||
pub fn visual_yank(&mut self, line_mode: bool, cx: &mut ViewContext<Self>) {
|
||||
pub fn visual_yank(&mut self, cx: &mut ViewContext<Self>) {
|
||||
self.store_visual_marks(cx);
|
||||
self.update_editor(cx, |vim, editor, cx| {
|
||||
let line_mode = line_mode || editor.selections.line_mode;
|
||||
editor.selections.line_mode = line_mode;
|
||||
let line_mode = editor.selections.line_mode;
|
||||
vim.yank_selections_content(editor, line_mode, cx);
|
||||
editor.change_selections(None, cx, |s| {
|
||||
s.move_with(|map, selection| {
|
||||
|
@ -657,7 +651,7 @@ impl Vim {
|
|||
self.stop_recording(cx);
|
||||
self.visual_delete(false, cx)
|
||||
}
|
||||
Some(Operator::Yank) => self.visual_yank(false, cx),
|
||||
Some(Operator::Yank) => self.visual_yank(cx),
|
||||
_ => {} // Ignoring other operators
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue