Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 0a8ddb1

Browse files
committed
Avoid posAtCoords getting confused by empty wrapping rectangles returned by Safari
FIX: Fix an issue where `posAtCoords`, when querying line wrapping points, got confused by extra empty client rectangles produced by Safari. Closes codemirror/dev#1679
1 parent f22a194 commit 0a8ddb1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/cursor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ class InlineCoordsScan {
289289
let rects = getRects(mid)
290290
if (rects) for (let i = 0; i < rects.length; i++) {
291291
let rect = rects[i], side = 0
292+
// Ignore empty rectangles when there are other rectangles
293+
if (rect.width == 0 && rects.length > 1) continue
292294
if (rect.bottom < this.y) {
293295
if (!above || above.bottom < rect.bottom) above = rect
294296
side = 1

0 commit comments

Comments
 (0)