Skip to content

Commit a9f8c72

Browse files
committed
📝 spec(renderer): specify caret behavior at wrap boundaries
1 parent 49f5508 commit a9f8c72

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

specs/renderer-spec.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ offset `N`:
354354
- If `N > [...content].length` or `N < 0`, behavior is unspecified; callers must
355355
keep offsets within bounds.
356356

357+
When the layout engine consumes whitespace at a wrap boundary — dropping it
358+
from the rendered text so that neither wrapped line contains a display cell for
359+
those code points — the caret has no display position of its own for any offset
360+
that falls in that dropped run. In that case the caret's cell is the origin of
361+
the following wrapped line (the display position of the first code point on
362+
that line). This rule keeps the caret on-screen at the point where subsequent
363+
input will land, rather than orphaning it past the end of the previous line.
364+
357365
When `content` is empty, the only in-range offset is `0`. In that case the
358366
caret's cell is the text element's origin — the cell at which the first code
359367
point of `content` would be drawn if `content` were a single space. This is a

0 commit comments

Comments
 (0)