Repository navigation
Entry: a click places the caret in widget-local coordinates - #485
Merged
Merged
Conversation
OnEvent's X is widget-local, the package convention and what every container delivers. Entry subtracted its own Bounds().X from it a second time, so in any form (an Entry not at the surface's left edge) a click put the caret at 0 and the next keystrokes went in front of the old value. SearchEntry already did it right. TestEntryClickPositionsCaret encoded the bug (it clicked at a surface x on a lone Entry); it now clicks locally. TestEntryClickThroughAContainer clicks through an HBox and types: it fails without the fix (caret 0). Found by the go-fft playground's browser protocol: typing a length into its N field produced 1001000 instead of 1009. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Entry.OnEventmapped a click to a caret position withev.X - (e.Bounds().X + pad). Butev.Xis already widget-local (the package convention;translateEventdelivers it that way), so the Entry's own X was subtracted twice. Any Entry not at the surface's left edge (that is, every Entry in a form) put the caret at 0 on a click, and typing went in front of the existing value.SearchEntryalready does it right (ev.X-(padX+iconW)+s.scrollX).ev.X - pad + e.scrollXTestEntryClickPositionsCaretencoded the bug: it clicked a lone Entry at a surface x. It now clicks at a local x.TestEntryClickThroughAContainer: an Entry inside an HBox at (30, 40), clicked through the box, then typed into. It fails without the fix (caret at 0), passes with it.Package coverage still 100% locally.
Found by the go-fft WASM playground's browser checks: clicking its
Nfield (showing1000) and typing1009produced1001000.🤖 Generated with Claude Code