Cursor goes on right side of bookmark in RTL mode


If I go to
and execute the following snippet to place a bookmark at the beginning of an empty line and then place the cursor on that line, the caret goes to the right of the bookmark. When I start typing, the text appears to the left of the bookmark (as it should).

I tried fiddling with insertLeft option, but that will cause the text I write to end up on the right side of the bookmark.

Is this a bug in CodeMirror’s RTL handling, or am I doing something wrong?

cm = document.querySelector('.CodeMirror').CodeMirror;
elm = document.createElement('span');
elm.innerHTML = '<b>1.</b>'
cm.setBookmark({line: 2, ch: 0}, {
  widget: elm

It is not a major issue, it just seems a bit strange that the caret ends up in a “readonly” place.


This is probably due to widget-related code not being bidi-aware, yes (though I can’t from the top of my head figure out why it would go wrong). I agree it’s not a high-priority issue, but if someone wants to look into it I’d be interested in a patch.