vim: Fix gv after actions (#14829)
Fixes: #13720 Co-Authored-By: <tobbe@tlundberg.com> Release Notes: - vim: Fixed `gv` after `y`, `d`, etc. ([#13760](https://github.com/zed-industries/zed/issues/13760)).
This commit is contained in:
parent
5e635b8914
commit
d2efa12e16
7 changed files with 32 additions and 4 deletions
|
@ -410,6 +410,7 @@ pub fn other_end(_: &mut Workspace, _: &OtherEnd, cx: &mut ViewContext<Workspace
|
|||
}
|
||||
|
||||
pub fn delete(vim: &mut Vim, line_mode: bool, cx: &mut WindowContext) {
|
||||
vim.store_visual_marks(cx);
|
||||
vim.update_active_editor(cx, |vim, editor, cx| {
|
||||
let mut original_columns: HashMap<_, _> = Default::default();
|
||||
let line_mode = line_mode || editor.selections.line_mode;
|
||||
|
@ -463,6 +464,7 @@ pub fn delete(vim: &mut Vim, line_mode: bool, cx: &mut WindowContext) {
|
|||
}
|
||||
|
||||
pub fn yank(vim: &mut Vim, cx: &mut WindowContext) {
|
||||
vim.store_visual_marks(cx);
|
||||
vim.update_active_editor(cx, |vim, editor, cx| {
|
||||
let line_mode = editor.selections.line_mode;
|
||||
yank_selections_content(vim, editor, line_mode, cx);
|
||||
|
@ -1357,5 +1359,15 @@ mod test {
|
|||
"},
|
||||
Mode::Visual,
|
||||
);
|
||||
cx.simulate_keystrokes("y g v");
|
||||
cx.assert_state(
|
||||
indoc! {"
|
||||
«fishˇ» one
|
||||
«fishˇ» two
|
||||
«fishˇ» red
|
||||
«fishˇ» blue
|
||||
"},
|
||||
Mode::Visual,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue