Repository navigation
Stop words from jumping lines while you type - #5
Merged
Merged
Conversation
The caret was an inline-block, which gives the browser a line-break point between typed and ghost text. A word at the line end split around the caret. Draw the caret as a plain inline span with an absolutely positioned bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When you type near the end of a line, the word you are typing splits in two. The typed part stays on line 1 and the rest of the word jumps to line 2 ("whe" / "re"). Words keep moving as you type, which makes the prompt hard to read.
The caret was an
inline-block. Browsers allow a line break next to an inline-block, so the line could wrap at the caret, in the middle of a word.Fix
The caret is now a plain inline span, and an absolutely positioned
::afterdraws the bar. A plain inline span adds no break point, so the text wraps the same way it would without a caret.Proof
Same prompt, 880px window, after typing "cut until the e".
Before, "eval" splits around the caret:
After, "eval" stays whole on line 2:
A new Playwright check (
checkWordsStayPutWhileTyping) types a seeded prompt one key at a time at 11 widths from 800px to 1200px. After each key it checks that no character changed lines. It failed on the old CSS (11 keys moved words) and passes now. Lint, typecheck, unit tests and the fullnpm testpass. I tested in Chromium only. WebKit would not install on this Linux box, so Safari is untested.Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code. Reviewed by GPT-6.1 Sol in Codex.
🤖 Generated with Claude Code