Skip to content

sync: atualiza o fork com o upstream e reaplica o scroll de TUI - #1

Merged
jacobaraujo7 merged 40 commits into
jacobaraujo7:mainfrom
pretodev:cockpit-sync-upstream
Aug 7, 2026
Merged

sync: atualiza o fork com o upstream e reaplica o scroll de TUI#1
jacobaraujo7 merged 40 commits into
jacobaraujo7:mainfrom
pretodev:cockpit-sync-upstream

Conversation

@pretodev

@pretodev pretodev commented Aug 7, 2026

Copy link
Copy Markdown

Sincroniza este fork com os 37 commits que o elias8/libghostty acumulou desde
23/jul/2026 e reaplica, por cima da base nova, o único patch que ainda é
exclusivo daqui: o encaminhamento de scroll para TUIs sob mouse tracking.

O objetivo prático é dar ao Cockpit um ref novo para repinar. Hoje o
cockpit/pubspec.yaml aponta para a tag cockpit-pin-flterm-cpu-baseline
(103be857), cuja base é de 23/jul — 37 commits atrás do upstream.

Por que a divergência encolheu tanto

Dos 5 commits que a tag do pin carregava, 3 já foram absorvidos pelo
upstream
e por isso saem daqui:

Commit do pin Situação no upstream
469fb1c6 — isolamento do git no build hook mergeado em elias8#120
103be857 — compile no CPU baseline (-Dtarget) mergeado em elias8#132
e7bd2265 — reattach do IME órfão resolvido pelo elias8 em elias8#126, com implementação própria

Sobra o patch de scroll (2 commits), que continua aberto como elias8#119.

O que entra

1. Sincronização com elias8/libghostty@main (30b0b79)

Destaques do que o fork estava perdendo:

2. Encaminhamento de scroll sob mouse tracking (2 commits, autoria do Jacob)

Com mouse tracking ligado — TUIs como claude e vim na tela alternativa — o
wheel precisa virar reporte de mouse para o app em vez de rolar o scrollback do
viewport. Sem isso o Scrollable filho engole o evento e, como a tela
alternativa não tem scrollback, o scroll interno do app simplesmente não
funciona.

  • terminal_gesture_detector.dart: passa a tratar onPointerSignal
    (PointerScrollEvent) e os gestos onPointerPanZoomStart /
    onPointerPanZoomUpdate — no macOS o trackpad chega como pan/zoom, não como
    scroll, então sem esse segundo caminho o scroll de dois dedos não encaminha
    nada. Ambos convergem para _forwardScroll, que converte o delta vertical em
    passos de linha e emite botão 4 (cima) / 5 (baixo). Mouse é tratado como
    discreto (mínimo de uma linha por notch); trackpad é contínuo e acumula o
    resíduo fracionário, para não rolar rápido demais.
  • terminal_view.dart: o Scrollable do viewport recebe
    NeverScrollableScrollPhysics enquanto houver mouse tracking, de modo que os
    dois consumidores não disputem o mesmo pointer signal.

3. Tradução dos comentários para inglês

O patch de scroll tinha sido escrito com comentários em português, destoando do
resto do repositório. Ficaram em inglês num commit separado, que também aplica
dart format na assinatura de _forwardScroll. É mudança só de comentário —
nenhuma linha de lógica muda.

Verificação

Rebase feito por cherry-pick limpo sobre upstream/main, sem conflito.

cd packages/flterm
flutter analyze   # No issues found!
flutter test      # All tests passed! (766 testes)

Depois do merge

Cortar uma tag nova e trocar o ref dos dois blocos de dependency_overrides
do cockpit/pubspec.yaml. Vale revisar, na mesma passada, o comentário longo
que hoje descreve os quatro fixes carregados — três deles viraram upstream e o
texto ficou desatualizado.

Um cuidado no repin: como o ghostty.version mudou, o source: compile vai
buildar uma versão diferente do Ghostty. Confirmar que
ghostty_terminal_compression_activity — chamado no construtor do
TerminalControllerImpl do Cockpit — continua exportado, já que foi exatamente
esse símbolo que causou o dlsym: symbol not found no incidente anterior.

jacobaraujo7 and others added 30 commits July 26, 2026 15:08
CompileFromSource extracts the ghostty source under the consuming app's
directory (.dart_tool/hooks_runner/.../ghostty-source-<hash>/), which is
frequently inside the app's own git repository. Ghostty's build (Config.zig)
shells out to git to derive its version, and because the extracted source has
no .git of its own, that discovery walks up into the app's repo and reads the
app's tag.

When the app is checked out on a tag that isn't vX.Y.Z -- e.g. a CI release
build tagged `myapp-v1.2.3` -- Config.zig panics:

    thread panic: tagged releases must be in vX.Y.Z format matching build.zig

This breaks every tagged release build for any consumer whose tag scheme
differs from ghostty's, on all four desktop targets. It only escapes local
dev because an untagged HEAD falls into the branch/short-hash path.

Fence git at the extracted source's parent via GIT_CEILING_DIRECTORIES (must
be absolute) so the upward walk stops before reaching the app repo. Ghostty
then finds no repository and cleanly falls back to a dev version through the
existing Config.zig error.GitNotRepository path -- not a hack, the intended
fallback.

Verified end-to-end: with a `cockpit-v1.15.0` tag on the consumer repo (which
otherwise reproduces the panic), a cold `zig build` completes and emits a
dylib exporting the expected symbols.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Prevent Ghostty source builds from reading consumer Git tags, avoiding
version-detection failures in tagged releases.
Add repeatable benchmarks for terminal input throughput and Flutter
frame performance. The suite measures streaming and interactive input
alongside clean, partial, full-screen, new-glyph, and first-frame
rendering under a fixed terminal and font setup, then emits normalized
results for comparison across revisions.

Note: I provided the direction and used GPT 5.5 to write the benchmark
suite, including its README.
Prepare libghostty v0.0.12 with new clipboard, compression, and geometry
APIs; lower overhead query, formatting, and Kitty image paths; and fixes
across resize, selection, grid, callback, and source build behavior.
This also includes the breaking Kitty temporary file directory API.
Prepare flterm v0.0.5 with clipboard writes, idle scrollback
compression, lower overhead Kitty graphics caching, improved color
behavior, and fixes for IME layout, viewport scrolling, and Windows text
input. This also trims published package contents and updates the
libghostty dependency to v0.0.12.
Reconnect terminal text input when another client takes ownership of the
platform connection, and clear any active preedit state before reopening
it. This keeps IME input recoverable without sending updates through an
orphaned connection.

Replaces elias8#124
Sync libghostty with the latest Ghostty source and bindings, exposing
scrollback limits, desktop notifications, and progress reports through
the native and WASM APIs. This also updates flterm to use the new
terminal construction API and adds coverage for the new behavior.
Forward libghostty's scrollback limits, desktop notifications, and
progress reports through flterm. Replace the single scrollback limit
with separate byte and line limits, expose the new callback types
through the package API, and apply the configured options when terminals
are created or reconfigured.
Remove the iOS Mach O alignment patcher and its tests now that Ghostty
builds Apple targets on Apple hosts with Apple's native linker. This
follows [Ghostty
#13430](ghostty-org/ghostty#13430), which
switches those builds away from Zig's Mach O linker and makes the post
build alignment patch unnecessary.
The compile hook only passed `-Dtarget` when cross-compiling
(os != current || arch != current). For a native build the flag was omitted,
so Zig defaulted the CPU model to `native` and tuned ghostty-vt for the build
machine. On a CI runner that means AVX2/AVX-512, and the resulting library
crashes with an illegal instruction (0xC000001D) on consumer CPUs without
those extensions -- e.g. the Windows release "flashes and closes" with no log
on some machines. Local source builds escaped it because native == the dev CPU.

Pass `-Dtarget` unconditionally; an explicit target resolves to the arch's
baseline CPU. This mirrors the upstream release workflow
(.github/workflows/build.yml), which already passes `-Dtarget` for every
artifact -- including the native ones -- which is why the prebuilt releases
run on older CPUs while the native compile path did not.

Verified: a native `zig build -Dtarget=aarch64-macos` still builds the dylib
successfully.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pass the iOS deployment version into Zig targets for source builds and
CI artifacts, producing aarch64-ios.13.0 and aarch64-ios.13.0-simulator
for the iOS 13 minimum. This keeps the binary load command aligned with
the framework's MinimumOSVersion.

Resolves elias8#127
Bumps [dart-lang/setup-dart/.github/workflows/publish.yml](https://github.com/dart-lang/setup-dart) from 1 to 1.7.2.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](dart-lang/setup-dart@v1...v1.7.2)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart/.github/workflows/publish.yml
  dependency-version: 1.7.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
elias8 and others added 10 commits August 4, 2026 17:07
Invalidate selection during widget updates without notifying listeners,
preventing `setState` calls during build while keeping explicit
selection clearing observable through the controller API.

Resolves elias8#136
Bumps [dart-lang/setup-dart/.github/workflows/publish.yml](https://github.com/dart-lang/setup-dart) from 1.7.2 to 1.8.0.
- [Release notes](https://github.com/dart-lang/setup-dart/releases)
- [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md)
- [Commits](dart-lang/setup-dart@v1.7.2...v1.8.0)

---
updated-dependencies:
- dependency-name: dart-lang/setup-dart/.github/workflows/publish.yml
  dependency-version: 1.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ias8#132)

Pass -Dtarget so source-compiled libraries use the target CPU baseline instead of the build machine's CPU.
…scroll)

With mouse tracking enabled (TUIs like Claude Code / vim in the alt-buffer), the
gesture detector only handled pointer down/move/up — there was no onPointerSignal
for the wheel, so the inner Scrollable swallowed it (scrolling the viewport
scrollback, which is empty/frozen in the alt-buffer). The app never received the
wheel as a mouse report, so its internal scroll did nothing.

Now, when tracked, onPointerSignal forwards the wheel to the app as mouse button
four (up) / five (down) presses (proportional for mouse notches, accumulated
fractions for trackpad; Shift bypasses so Shift+wheel stays local). The inner
Scrollable is set to NeverScrollableScrollPhysics under mouse tracking so the two
don't fight over the pointer signal (which was killing the app's internal scroll).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit a987855)
PointerScrollEvent only covers the mouse wheel and macOS's synthesized
trackpad scroll; two-finger trackpad on macOS frequently arrives as pan/zoom
gestures instead, which weren't forwarded, so internal TUI scroll did nothing
on the trackpad. Handle onPointerPanZoomStart/Update as well, routing the pan
delta through the same wheel-forward path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The wheel/pan-zoom forwarding landed with Portuguese comments; the rest
of the repository is documented in English. Comment-only change, plus a
dart format pass on the _forwardScroll signature.
@jacobaraujo7
jacobaraujo7 merged commit 94bb017 into jacobaraujo7:main Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants