Skip to content

Commit 32a5d55

Browse files
committed
Fix a missed case in the workaround for Safari's caretRangeFromPoint
FIX: Fix an issue where moving the cursor vertically from the one-but-last character on a line would sometimes move incorrectly on Safari. Issue codemirror/dev#1572 Issue codemirror/dev#401
1 parent 55fff2f commit 32a5d55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cursor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function isSuspiciousSafariCaretResult(node: Node, offset: number, x: number) {
227227
if (node.nodeType != 3 || offset != (len = node.nodeValue!.length)) return false
228228
for (let next = node.nextSibling; next; next = next.nextSibling)
229229
if (next.nodeType != 1 || next.nodeName != "BR") return false
230-
return textRange(node as Text, len - 1, len).getBoundingClientRect().left > x
230+
return textRange(node as Text, len - 1, len).getBoundingClientRect().left >= x
231231
}
232232

233233
// Chrome will move positions between lines to the start of the next line

0 commit comments

Comments
 (0)