mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-29 04:32:57 +00:00
Selecting a match 1,201 lines into an ordinary TypeScript file showed line 1,103 on an Android device. The match was never on screen, so the preview and Open flow could not deliver the occurrence they promised. The cause, measured rather than assumed. The list was told every row is one line of code tall. Probed on the device, a plain row is 17.52dp and a wrapped row is 140.19dp, because a row is as tall as the text needs and ordinary source lines wrap on a phone. Every wrapped line above the match therefore shrank the computed offset, and the list scrolled to a fraction of the real distance. Row geometry is now derived instead of assumed: one visual line is the reader's code size rounded the way the device rounds it, and a line occupies as many visual lines as it wraps onto, counted the way the platform wraps — greedily at spaces, mid-word only for a word too long for a line. The column count comes from measuring one monospace character at the current code size, so it follows the Appearance setting rather than a constant. Two smaller things fell out. The list renders only once that measurement exists, because scrolling a list still sized for a provisional geometry gets clamped to the shorter content and lands short. And the match is revealed near the top with two lines of context rather than centred, since centring is measured against the list's own box, which inside a sheet is taller than the part the reader can see. Verified on an Android device at the default code size and at 20px: preview and Open both show the highlighted text, across files and between two occurrences in one file.