Pad/scripts/check.sh
Greg Pomerantz d8b5bc704b Handle drags: 1:1 finger tracking with cross-flip; fix caret/taps on empty lines
Selection handles now track the finger 1:1 (anchor grab point + displacement)
instead of snapping by whole lines, and crossing the opposite handle flips
the selection (native behaviour) instead of clearing it.

Caret and tap/handle line resolution use VisualLineStarts instead of the
min-Y baseline: the window's first visual line may be an empty line with no
recorded glyphs, which used to draw boundary carets one line too low per
leading empty line and land taps/dragged handles one line below the finger.
New exported ui.CaretPoint centralises byte->insertion-point mapping.

The off-screen caret no longer clamps to the window edge: EditorLayout ships
the true (possibly negative / past-end) window-relative cursor and the
renderer skips the caret when the cursor is outside the shaped window, so
scrolling past the caret no longer makes it jump onto the top/bottom line.

IME/router replay fixes: key.FocusCmd is issued only on a focus transition
(a per-frame no-op still takes the immediate-command path and re-queues all
pointer events), and the key.SelectionCmd IME sync is deferred while a
handle drag is in progress (each push re-injected the drag into every
gesture). Handle drags forward only Grabbed events; a tap inside a handle
grab box is a no-op.

Also: key.FocusEvent no longer logs as unexpected in main; dead code removed
(worker taskWrapper, browser applyXxxResult stubs, scrollIndex, mock_setup
sortModeKey/lineSpan helpers); mock FileSystem.ListPaths prefix match uses
strings.HasPrefix; build scripts run the new scripts/check.sh static gate
(go vet + staticcheck). Tests: caret_point_test, touch_selection updates
(flip/empty-line cases), off-window caret e2e, selection drag e2e grab step.
2026-08-19 22:34:12 -04:00

32 lines
926 B
Bash
Executable File

#!/usr/bin/env bash
# Static analysis gate for release builds.
#
# Runs go vet and staticcheck (all default checks, including U1000 for dead
# code) over the whole module. A non-zero exit fails the release.
#
# Usage: ./scripts/check.sh
#
# Prefers a staticcheck binary on PATH (e.g. ~/go/bin/staticcheck) so
# repeated runs are fast; falls back to `go run` with a pinned version.
set -euo pipefail
REPO=$(cd "$(dirname "$0")/.." && pwd)
cd "$REPO"
# v0.7.0 cannot read Go 1.27's export data ("export data version 4 is
# greater than maximum supported version 2"); v0.8.0-rc.1 is the first
# release that can. Re-pin to stable v0.8.0 once it lands.
STATICCHECK_VERSION="v0.8.0-rc.1"
echo "=== go vet ==="
go vet ./...
echo "=== staticcheck ==="
if command -v staticcheck >/dev/null 2>&1; then
staticcheck ./...
else
go run honnef.co/go/tools/cmd/staticcheck@"$STATICCHECK_VERSION" ./...
fi
echo "=== checks passed ==="