Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Basic bidi overwrite cursor
  • Loading branch information
vanderlee committed Jan 26, 2016
commit 3ac377e3f6f175cd20a8787eafd336b3c6bd43db
7 changes: 5 additions & 2 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2323,8 +2323,11 @@
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
var content = "\u00a0";
if (cm.state.overwrite) {
var next = movePos(cm.doc, head, 1, 0);
content = next ? (getBetween(cm.doc, head, next)[0] || content) : content;
var lineObj = getLine(cm.doc, head.line);
var order = getOrder(lineObj);
var part = getBidiPartAt(order, head.ch);
var next = movePos(cm.doc, head, part % 2 ? -1 : 1, 0);
content = next ? (getBetween(cm.doc, part % 2 ? next : head, part % 2 ? head : next)[0] || content) : content;
}
var cursor = output.appendChild(elt("div", content, "CodeMirror-cursor"));
cursor.style.left = pos.left + "px";
Expand Down