Skip to content

Commit 8a25b23

Browse files
alurmarijnh
authored andcommitted
Fix 0-width fat cursor at EOL
In particular the fat cursor would be invisible on empty lines.
1 parent 8cc5d95 commit 8a25b23

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/display/selection.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export function drawSelectionCursor(cm, head, output) {
3939

4040
if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
4141
let charPos = charCoords(cm, head, "div", null, null)
42-
cursor.style.width = Math.max(0, charPos.right - charPos.left) + "px"
42+
if (charPos.right - charPos.left > 0) {
43+
cursor.style.width = (charPos.right - charPos.left) + "px"
44+
}
4345
}
4446

4547
if (pos.other) {

0 commit comments

Comments
 (0)