A simple, high performance text editor.
Go to file
Greg Pomerantz 587c1c5aad Fix find scroll position on long files
Two bugs made the search jump land in the wrong place:

1. Double-counted visual lines. The visual line at which logical line li
   starts is exactly VisualsBefore(li); the code computed li +
   VisualsBefore(li), i.e. 2x the intended depth with the all-ones
   pre-shape estimates. The MaxScroll clamp masked it on small files;
   long files landed far off. Now uses VisualsBefore(li) (fallback li).

2. Truncation vs non-integer line height. Line height is 16.8dp, so
   floor(V*lh) sits just above the target line's top and the window
   decomposition floors to the line above it. The target now rounds UP:
   ceil(V*lh) is always in [V*lh, (V+1)*lh), so the viewport top
   decomposes to exactly V. The line-height source now also prefers the
   shaped GlyphLayout.LineHeight like scrollVisualDecompose/MaxScroll.

3. Estimate settle. On long wrapped files the lines above the target are
   still estimated at 1 visual line when the jump happens, so the landing
   can be short. The scroll now arms a bounded settle (SettleByte /
   SettleScroll / SettlePasses on FindState); after each layout-feedback
   wrap-count correction the logic goroutine re-runs the target and
   re-scrolls until it converges, is exhausted (4 passes), or the user /
   the MaxScroll clamp moves the viewport (which cancels it). Edits,
   query changes, close, and file open disarm the settle.

Tests: round-trip scroll-target on a 2000-line wrapped file, the
no-wrap identity, settle correction/convergence, and settle cancellation
on user scroll.
2026-08-20 06:50:14 -04:00
.qwen Add ShapeText/DrawShapedText: single shaper call, zero-call drawing 2026-05-12 12:06:28 -04:00
cmd/pad Add in-file search (find bar) 2026-08-20 00:02:54 -04:00
doc Add in-file search (find bar) 2026-08-20 00:02:54 -04:00
internal Fix find scroll position on long files 2026-08-20 06:50:14 -04:00
scripts Handle drags: 1:1 finger tracking with cross-flip; fix caret/taps on empty lines 2026-08-19 22:34:12 -04:00
.DS_Store Add drawPng function to Renderer for PNG icon rendering 2026-05-10 06:26:29 -04:00
.gitignore Refactor RealFileSystem to use WorkingDir, and ensure clean shutdown with FlushAll 2026-06-05 11:42:39 -04:00
go.mod Update to gioui v0.10.0. 2026-06-03 22:17:52 -04:00
go.sum Update to gioui v0.10.0. 2026-06-03 22:17:52 -04:00