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:
Conrad Irwin 2024-09-27 10:06:19 -06:00 committed by GitHub
parent 6d4ecac610
commit ffd1083cc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 220 additions and 104 deletions

View file

@ -395,9 +395,9 @@ impl Vim {
self.store_visual_marks(cx);
self.update_editor(cx, |vim, editor, cx| {
editor.transact(cx, |editor, cx| {
let mut original_positions = vim.save_selection_starts(editor, cx);
let original_positions = vim.save_selection_starts(editor, cx);
editor.toggle_comments(&Default::default(), cx);
vim.restore_selection_cursors(editor, cx, &mut original_positions);
vim.restore_selection_cursors(editor, cx, original_positions);
});
});
if self.mode.is_visual() {
@ -467,7 +467,7 @@ impl Vim {
&self,
editor: &mut Editor,
cx: &mut ViewContext<Editor>,
positions: &mut HashMap<usize, Anchor>,
mut positions: HashMap<usize, Anchor>,
) {
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.move_with(|map, selection| {