Skip to content

Commit 1b3c322

Browse files
nightwingmarijnh
authored andcommitted
[vim] fix fat cursor staying after O
1 parent 6974e1a commit 1b3c322

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

keymap/vim.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@
287287
}
288288

289289
function updateFatCursorMark(cm) {
290+
if (!cm.state.fatCursorMarks) return;
290291
clearFatCursorMark(cm);
291292
var ranges = cm.listSelections(), result = []
292293
for (var i = 0; i < ranges.length; i++) {
@@ -309,17 +310,20 @@
309310
function clearFatCursorMark(cm) {
310311
var marks = cm.state.fatCursorMarks;
311312
if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
312-
cm.state.fatCursorMarks = null;
313313
}
314314

315315
function enableFatCursorMark(cm) {
316+
cm.state.fatCursorMarks = [];
316317
updateFatCursorMark(cm)
317318
cm.on("cursorActivity", updateFatCursorMark)
318319
}
319320

320321
function disableFatCursorMark(cm) {
321322
clearFatCursorMark(cm);
322323
cm.off("cursorActivity", updateFatCursorMark);
324+
// explicitly set fatCursorMarks to null because event listener above
325+
// can be invoke after removing it, if off is called from operation
326+
cm.state.fatCursorMarks = null;
323327
}
324328

325329
// Deprecated, simply setting the keymap works again.

0 commit comments

Comments
 (0)