Skip to content

Commit 0fc59fd

Browse files
committed
[vim] Fix visual mode mouse bugs
1 parent 02274d3 commit 0fc59fd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

keymap/vim.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,7 +4338,12 @@
43384338
} else if (cm.doc.history.lastSelOrigin == '*mouse') {
43394339
// Reset lastHPos if mouse click was done in normal mode.
43404340
vim.lastHPos = cm.doc.getCursor().ch;
4341-
} else if (vim.visualMode) {
4341+
}
4342+
if (cm.somethingSelected()) {
4343+
vim.visualMode = true;
4344+
cm.setOption('showCursorWhenSelecting', false);
4345+
}
4346+
if (vim.visualMode) {
43424347
var from, head;
43434348
from = head = cm.getCursor('head');
43444349
var anchor = cm.getCursor('anchor');
@@ -4352,7 +4357,6 @@
43524357
vim.fakeCursor.clear();
43534358
}
43544359
vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'});
4355-
cm.setOption('showCursorWhenSelecting', false);
43564360
}
43574361
}
43584362

0 commit comments

Comments
 (0)