Skip to content

sync: atualiza o fork com elias8/libghostty@7993603 (libghostty 0.0.13 + fixes de render do flterm) - #2

Open
pretodev wants to merge 34 commits into
jacobaraujo7:mainfrom
pretodev:cockpit/sync-upstream-2026-08-22-pr
Open

sync: atualiza o fork com elias8/libghostty@7993603 (libghostty 0.0.13 + fixes de render do flterm)#2
pretodev wants to merge 34 commits into
jacobaraujo7:mainfrom
pretodev:cockpit/sync-upstream-2026-08-22-pr

Conversation

@pretodev

@pretodev pretodev commented Aug 22, 2026

Copy link
Copy Markdown

Sincroniza este fork com elias8/libghostty@7993603 (main, 2026-08-20) — 21 commits à frente da tag que o Cockpit consome hoje (cockpit-pin-flterm-ios-recover / f276e41).

O que entra

libghostty 0.0.13

  • Refactor da API pública: lib/src/impl/lib/src/api/, bindings quebrados por domínio (terminal/, render/, selection/, key/, mouse/) com paridade FFI ↔ Wasm.
  • Sync da C API do Ghostty: ghostty.version 34282fcb97b17f.
  • Perf: travessia de render otimizada (iteração por linha suja) e buffers de pixel Kitty reutilizáveis.
  • Tipos públicos imutáveis, exceções com código de resultado + contexto da operação.
  • Novas APIs: writeUntilGround, isVtGround, isCursorAtPrompt, terminfoName, onUnknownSequence.

flterm

  • Render incremental via linhas sujas.
  • Cursor e preedit de IME respeitam validade de posição no viewport e o estilo visual reportado.
  • Métrica de glifos Nerd Font e shaping estável de ligaduras de operador.
  • Render estável de imagem e placement Kitty.

Resolução de conflitos

Os três commits de scroll-forwarding deste fork (04734fa, 6e355e8, ee95dfc) foram descartados em favor da implementação upstream:

Conflito Resolução
lib/src/widgets/terminal_gesture_detector.dart deletado no upstream; a função passou para lib/src/input/scroll_gesture_region.dart
lib/src/widgets/terminal_view.dart movido para lib/src/view/terminal_view.dart

O scroll_gesture_region do upstream reimplementa os dois comportamentos que o fork tinha patcheado, e vai além:

  • _gestureMode() retorna .pan sempre que mouseTracking != .none, e null sob Shift — então Shift+wheel continua rolando localmente. É a mesma regra do 04734fa.
  • Trackpad pan/zoom é tratado por supportedDevices: {.touch, .trackpad} + addAllowedPointerPanZoom, com momentum balístico — supera o delta manual via _panZoomLast do 6e355e8.

A árvore resultante do merge é byte-a-byte idêntica a upstream/main + o patch de iOS, ou seja: nenhum resíduo do desenho antigo sobrou.

O patch que o fork ainda carrega

Um só: bc2c524, recuperação do text input quando uma delta desincroniza do sentinel. No iOS, compor um acento (dead key + vogal) fazia uma delta referenciar offsets além do sentinel; o delta.apply estourava e a exceção derrubava o canal de text input — a digitação congelava por completo. Está aberto upstream como elias8#145 (sem merge; o mantenedor não conseguiu reproduzir).

Validação

Portão Resultado
flutter test (packages/flterm) +970 All tests passed!
dart test (packages/libghostty) +475 All tests passed!
flutter analyze (cockpit consumindo esta ref) zero error em lib/ e test/
flutter test (cockpit) mesma contagem e mesmos nomes de falha do pin antigo — zero regressão

⚠️ Para quem consome pelo Cockpit

Cache de native assets precisa ser invalidado. O ghostty.version muda e os bindings passam a chamar ghostty_render_state_clean, ghostty_render_state_row_iterator_next_dirty e ghostty_terminal_vt_write_until_ground. Com a dylib antiga em cache o processo morre no carregamento (exit -10). Apagar .dart_tool/hooks_runner e build/native_assets antes do primeiro build.

elias8 and others added 30 commits August 7, 2026 21:04
Expose reset-mode defaults, opt-in title reports, and replay-safe continuation bytes through the public Terminal API. Keep continuation limits explicit and preserve the upstream security default for title queries.
Sync libghostty with the latest Ghostty APIs and expose terminal mode
defaults, opt-in title reports, and replay-safe VT continuation bytes
through the native and WASM bindings. Continuation limits stay explicit,
and title queries remain disabled by default.
Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](dorny/paths-filter@7b450ff...ceb8a2b)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-version: 4.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Resolve lint-rule conflicts, migrate Material imports to the standalone material_ui package, and keep package analysis clean across the workspace.
Update the workspace for Flutter 3.47 by refreshing the shared lint
configuration, removing conflicting or unsupported rules, and migrating
affected code to the standalone `material_ui` package. This keeps
package analysis and tests clean with the new SDK.
…s8#143)

Separate terminal-session behavior from Flutter view state so
`TerminalController` owns libghostty state, geometry, selection, and
backend callbacks while `TerminalView` owns focus, text input,
scrolling, gestures, and rendering lifecycle.

- Keep `TerminalController` as an abstract contract for
application-level test doubles; move focus and soft-keyboard control to
`TerminalView`, make callbacks setter-only, stop exporting
`KeyboardState` and `TerminalScrollPosition`, and reject concurrent view
attachments.
- Route measured geometry through one controller-owned transaction, emit
in-band resize output before backend `onResize`, and keep terminal,
mouse, and selection geometry synchronized.
- Harden input and lifecycle handling across AltGr, IME newline/deletion
pairing, lock modifiers, mouse and stylus button transitions, gesture
ownership, controller swaps, and font-data changes, with focused
coverage for each behavior.

Supersedes elias8#119
Refine flterm’s internal architecture around clear ownership boundaries and consistent domain-oriented naming. Keep implementation, tests, and benchmarks aligned while preserving terminal behavior and controller/view lifecycle contracts.
…es (elias8#144)

Follow-up to elias8#143.

Refine flterm’s internal architecture around clearer ownership
boundaries and consistent domain-oriented naming. The matching source,
tests, and benchmark references now follow those boundaries while
preserving terminal behavior and controller/view lifecycle contracts.
…ndings (elias8#146)

Redesign libghostty’s C ABI seam around focused native and Wasm bindings
while preserving existing behavior and keeping platform details
internal. Strengthen runtime layout, result, ownership, lifetime,
callback, and memory safety; improve hot path allocation behavior;
expose idiomatic public wrappers; and align ABI and behavioral tests
with the shared native and Wasm contracts.

This change touches nearly every file in the libghostty package and is
close to a complete internal rewrite, while preserving existing behavior
and most of the public API. The public API was already in a good place,
but the internals had not kept pace with the growth of the C ABI since
the package’s initial implementation. I have wanted to do this
refactoring for some time. The resulting structure gives each platform
binding a clearer boundary, makes behavioral consistency between native
and Wasm explicit and enforceable, and should make future ABI additions
easier to implement and maintain.

I plan a few focused follow up PRs, mainly around the build system and
further quality improvements.

Note: I planned and iterated on these changes myself, while using LLMs
extensively for the mechanical implementation work.
Sync libghostty with the latest Ghostty source and bindings, exposing VT
ground-state processing, prompt state, terminfo configuration,
unknown-sequence callbacks, structured cursor state, and dirty-render
APIs across native and Wasm. This also updates flterm for the cursor API
change, adopts bulk cell and dirty-row traversal, and expands coverage
for the new behavior.
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 21 to 23.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](dawidd6/action-download-artifact@b6e2e70...57aa996)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '23'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Stabilize flterm’s Kitty graphics rendering by retaining ready images
across unchanged frames and replacements, bounding and deduplicating
asynchronous decode work, reusing pixel storage, and refreshing
placement geometry when terminal dimensions change. This also replaces
the allocating Kitty image pixel getter with a destination-required copy
API across the native and Wasm libghostty bindings, with focused
coverage for image lifetime, decode failure and backpressure, placement
snapshots, resizing, and rendering behavior.

Supersedes elias8#107
Bumps [browser-actions/setup-chrome](https://github.com/browser-actions/setup-chrome) from 2.1.2 to 2.2.0.
- [Release notes](https://github.com/browser-actions/setup-chrome/releases)
- [Changelog](https://github.com/browser-actions/setup-chrome/blob/master/CHANGELOG.md)
- [Commits](browser-actions/setup-chrome@2e1d749...48ad923)

---
updated-dependencies:
- dependency-name: browser-actions/setup-chrome
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
elias8 and others added 4 commits August 20, 2026 12:59
Improve flterm’s terminal rendering by fitting fallback symbols within
cell geometry while preserving their aspect ratio and spacing, shaping
complete operator ligature runs, and pairing Kitty image pixels and
placements by generation so compatible replacements can retain the last
complete frame.
The session keeps a one-space sentinel and pushes it back via setEditingState
after every commit. Some platforms -- notably iOS -- keep their own marked-text
buffer and ignore that reset, so a later delta references offsets past our
sentinel value. Applying it throws (RangeError), and because that happens
inside updateEditingValueWithDeltas the exception tears down the text-input
channel: typing freezes completely. It reproduces on iOS right after composing
an accent (dead key + vowel), which commits an IME-like character and resets
the buffer the platform then ignores.

Guard each delta.apply; on failure, resync the platform back to the sentinel
and drop the batch instead of letting the exception kill the connection. A
regression test drives a delta whose range exceeds the sentinel and asserts the
session recovers, stays attached, and keeps accepting input.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…bghostty

Brings this fork up to elias8/libghostty@7993603 (main, 2026-08-20), 21 commits
ahead of the tag currently pinned by the Cockpit
(cockpit-pin-flterm-ios-recover / f276e41).

libghostty 0.0.13: public API refactor (lib/src/impl -> lib/src/api, bindings
split per domain with FFI/Wasm parity), Ghostty C API sync (ghostty.version
34282fc -> b97b17f), render traversal optimization (dirty-row iteration),
reusable Kitty pixel buffers, typed public values, richer exceptions, and new
APIs (writeUntilGround, isVtGround, isCursorAtPrompt, terminfoName,
onUnknownSequence).

flterm: incremental render via dirty rows, cursor/IME preedit honouring
viewport validity and reported visual style, Nerd Font glyph metrics and
operator ligature shaping, and stable Kitty image/placement rendering.

Conflict resolution — the fork's three scroll-forwarding commits (04734fa,
6e355e8, ee95dfc) are dropped in favour of the upstream implementation:

- packages/flterm/lib/src/widgets/terminal_gesture_detector.dart is deleted
  upstream; its job now belongs to lib/src/input/scroll_gesture_region.dart.
- lib/src/widgets/terminal_view.dart moved to lib/src/view/terminal_view.dart.

The upstream region reimplements both behaviours the fork had patched in, and
goes further: _gestureMode() returns .pan whenever mouseTracking != .none
(returning null under Shift, so Shift+wheel still scrolls locally — same rule
as 04734fa), and trackpad pan/zoom is handled through
supportedDevices: {.touch, .trackpad} plus addAllowedPointerPanZoom with
ballistic momentum, superseding the manual _panZoomLast delta of 6e355e8.

The single patch this fork still carries on top of upstream is bc2c524, the iOS
text-input recovery (open upstream as elias8#145).
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