Skip to content

Replace Android terminal fallback with native Ghostty renderer parity #5

Description

@HorusGoul

Context

@t3tools/mobile-terminal-native already registers T3TerminalSurface on both Apple and Android. The iOS implementation uses vendored GhosttyKit.xcframework / libghostty and owns a real terminal rendering surface.

Android currently has the same view name and event payloads, but the implementation is a simple TextView/EditText surface that prints the buffer and forwards typed text.

Why this matters

The terminal feature is used for interactive remote PTY sessions from thread/git controls. The JS/RPC layer is platform-neutral, but Android does not yet have terminal renderer parity with iOS.

Important behavior to preserve or add:

  • remote PTY output rendering with terminal escape sequence support
  • measured terminal cols / rows resize events
  • keyboard input, return, backspace, and control sequences
  • scrollback and touch/scroll handling
  • theme configuration parity with buildGhosttyThemeConfig
  • stable behavior under reconnects and large buffers

Feature examples

  • Users can open a terminal for a thread/worktree and interact with a running shell.
  • Project script launch flows can reuse or open terminal sessions.
  • The UI should not report a full native Ghostty surface on Android until renderer parity is real.

Acceptance criteria

  • Replace the Android TextView/EditText fallback renderer with a real terminal emulator backend, preferably an Android Ghostty/libghostty build if feasible.
  • Keep the existing JS contract stable: { data } input events, { cols, rows } resize events, initialBuffer, theme props, and terminalKey.
  • Preserve the current Android module registration so the React Native screen and RPC code stay platform-neutral.
  • Handle keyboard input, backspace, return, control sequences, scroll, resize, and large output buffers reliably.
  • Update UI/status copy if the surface is partial or not Ghostty-backed.
  • Add Android-native tests or instrumentation coverage for input/resize/render lifecycle where practical.

Current test coverage note

There are TypeScript tests around terminal model/state, route bootstrap, buffer replay, native module resolution, menu behavior, and theme logic (apps/mobile/src/features/terminal/*.test.ts). I did not find native Swift tests for the iOS Ghostty-backed view, and the existing Android native implementation has no native tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions