fix: clip input text, selection, and caret to the field viewport - #36
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d61d7dc14c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| content_clip := intersect_rect(text_field_content_rect(rect(x, y, | ||
| el.frame.width, el.frame.height), padding_left), clip) | ||
| if content_clip.width > 0 && content_clip.height > 0 { | ||
| apply_clip(ctx, content_clip) |
There was a problem hiding this comment.
Keep the active end of long inputs visible
In the immediate renderer, a default left-aligned field whose text is wider than content_width keeps text_origin fixed at the left edge while calculating cursor_x from the full prefix width. This new scissor therefore hides the caret and newly appended characters; because focusing or clicking a text field places the caret at rune_len(editor.text), editing an existing long value gives no visible insertion point or feedback. Apply a horizontal text offset that keeps the active caret or selection endpoint inside the viewport before clipping.
Useful? React with 👍 / 👎.
Fixes #33.
Changes
Verification
Passed with V 0.5.2 on Linux:
These checks passed before the branch was committed and published in the isolated verification run. That shared run later failed on an unrelated existing scrolling test while verifying a different issue; the commands above succeeded.
Manual pixel-level GUI verification has not been performed. This PR contains only the fix and regression tests, not the temporary verification workflow.