Skip to content

Commit 4b9e1a0

Browse files
committed
fix cursor taking color of previous character
1 parent 6cf80d6 commit 4b9e1a0

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/block-cursor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ function measureCursor(cm: CodeMirror, view: EditorView, cursor: SelectionRange,
179179
let base = getBase(view);
180180
let domAtPos = view.domAtPos(head);
181181
let node = domAtPos ? domAtPos.node : view.contentDOM;
182+
if (node instanceof Text && domAtPos.offset >= node.data.length) {
183+
if (node.parentElement?.nextSibling) {
184+
node = node.parentElement?.nextSibling;
185+
domAtPos = {node: node, offset: 0};
186+
};
187+
}
182188
while (domAtPos && domAtPos.node instanceof HTMLElement) {
183189
node = domAtPos.node;
184190
domAtPos = {node: domAtPos.node.childNodes[domAtPos.offset], offset: 0};

0 commit comments

Comments
 (0)