You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
vim cursor is not visible on empty lines in command mode #6312
Position the cursor on any empty line and hit escape. The cursor vanishes. The line must be completely empty, i.e. no whitespace or visible characters.
Seen with Chrome Version 83.0.4103.97 (Official Build) (64-bit) and Firefox 77.0.1 (64-bit) on macOS 10.15.5.
The default inputStyle option for mobile browsers is "contenteditable".
The vim keymap uses a different method for showing the normal mode cursor (fat cursor) in contenteditable: it uses doc.markText to mark the current character. An empty line does not have any character, so the mark does not show up.
One workaround is to explicitly set the option inputStyle: "textarea" in the CodeMirror initializer. Another is to change the line in codemirror.js that says
* CodeMirror as of v5.59.0 has an issue where some non-mobile browsers might be detected as iOS and thus mobile (in `src/util/browser.js`). This is recently fixed in the master branch (See [Incorrect iOS detection with Chrome on multi-touch supported Windows device (e.g. Surface Go) #6532](https://github.com/codemirror/CodeMirror/issues/6532)).
* The default `inputStyle` option for mobile browsers is "contenteditable".
* The vim keymap uses a different method for showing the normal mode cursor (fat cursor) in contenteditable: it uses `doc.markText` to mark the current character. An empty line does not have any character, so the mark does not show up.
One workaround is to explicitly set the option inputStyle: "textarea" in the CodeMirror initializer. Another is to change the line in codemirror.js that says
var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
The second workaround added to 5.59.2 didn't really do the trick, and the first workaround is not good either since IMEs do not work well when the mode is textarea rather than contenteditable.
Any other tricks? Or do we need to wait for a formal Codemirror fix of VIM invisible cursor or IMEs working in textarea mode?
Activity
ppasupat commentedon Dec 31, 2020
Possibly related: #6393
I had the same issue and found the following:
src/util/browser.js). This is recently fixed in the master branch (See Incorrect iOS detection with Chrome on multi-touch supported Windows device (e.g. Surface Go) #6532).inputStyleoption for mobile browsers is "contenteditable".doc.markTextto mark the current character. An empty line does not have any character, so the mark does not show up.One workaround is to explicitly set the option
inputStyle: "textarea"in the CodeMirror initializer. Another is to change the line incodemirror.jsthat saysto
schmoelder commentedon Oct 16, 2021
Is there anything that can be done to help fix this issue? It's really limiting CodeMirror's functionality for me.
Komediruzecki commentedon Oct 26, 2021
The second workaround added to 5.59.2 didn't really do the trick, and the first workaround is not good either since IMEs do not work well when the mode is
textarearather thancontenteditable.Any other tricks? Or do we need to wait for a formal Codemirror fix of VIM invisible cursor or IMEs working in
textareamode?