fix: make the input cursor follow the caret without clipping text #6
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/6/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The block cursor was pinned to the end of the line: moving the caret
(arrow keys, Home/End, click-to-position) changed the insertion point
but not the visible cursor, since syncCursor() placed it at the full
input width and only ran on value-changing events.
The fix is subtle because #input-sizer is dual-purpose — it both
measures the cursor position and sizes #input-wrap (and thus the
100%-width #cmd-input). Shrinking the sizer to the caret prefix moved
the cursor correctly but clipped every character after the caret.
Instead:
it overlaps; the block is kept at end-of-line over empty space.
Adds js/cursor.js (pure caret-prefix helper) with unit tests.