Skip to content

Commit 2b9b089

Browse files
authored
Give fat cursors the width of the character after them
1 parent d3f33a2 commit 2b9b089

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/display/selection.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export function drawSelectionCursor(cm, head, output) {
3737
cursor.style.top = pos.top + "px"
3838
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
3939

40+
if (/cm-fat-cursor/.test(cm.getWrapperElement().className)) {
41+
let charPos = charCoords(cm, head, "div", null, null);
42+
cursor.style.width = Math.max(0, charPos.right - charPos.left) + "px";
43+
}
44+
4045
if (pos.other) {
4146
// Secondary cursor, shown when on a 'jump' in bi-directional text
4247
let otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))

0 commit comments

Comments
 (0)