Skip to content

fix(tui): termux-gate scrollback preservation, touch-friendly defaults - #28910

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-37b74b95
May 19, 2026
Merged

fix(tui): termux-gate scrollback preservation, touch-friendly defaults#28910
teknium1 merged 1 commit into
mainfrom
hermes/hermes-37b74b95

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #28779 by @adybag14-cyber, rebased on current main (post #28829) and trimmed to the three substantive Termux UX wins.

Summary

Adds a Termux runtime detection helper and gates three TUI defaults on it: skip scrollback clear on startup, default INLINE_MODE on, default mouse tracking off. Non-Termux platforms keep every existing default.

Changes

  • New ui-tui/src/lib/termux.tsisTermuxEnv() (TERMUX_VERSION or Termux PREFIX), isTermuxTuiMode() (defaults on under Termux, opt-out via HERMES_TUI_TERMUX_MODE=0)
  • ui-tui/src/config/env.tsTERMUX_TUI_MODE export; MOUSE_TRACKING now supports explicit HERMES_TUI_MOUSE_TRACKING=0/1 and defaults off on Termux (legacy HERMES_TUI_DISABLE_MOUSE preserved off-Termux); INLINE_MODE defaults on under Termux (override with HERMES_TUI_INLINE=0/1)
  • ui-tui/src/entry.tsx — skip the destructive \x1b[2J\x1b[H\x1b[3J startup clear on Termux so prior output stays visible in scrollback
  • ui-tui/src/__tests__/termux.test.ts — 6 unit tests covering the detection + override matrix

What was dropped from the original PR

  • TERMUX_HISTORY_MAX=4000 and the useMainApp.ts history-cap parameterization — fix(tui): render full assistant text in scrollback (no history truncation) #28829 already removed render-side history truncation for all platforms, and bumping the in-memory cap 5x specifically on memory-constrained mobile is the wrong direction.
  • padTickerDuration / status-line width padding and the cwd-label width tweak — orthogonal cosmetics, not Termux-specific.

Validation

  • npm run type-check
  • npm test -- src/__tests__/termux.test.ts --run → 6/6 pass
  • Full npm test: 577 → 583 passed; pre-existing 9 failures unchanged from baseline (terminalSetup / textInputWrap / cursorDriftRegression).

Closes #28779. Credit to @adybag14-cyber — original commit cherry-picked with authorship preserved; this PR is the trimmed-and-rebased version.

Adds a Termux runtime detection helper and gates three TUI defaults on it:

- Skip the startup scrollback clear on Termux so users can review/copy
  earlier output after reopening the app. Desktop keeps the existing
  \x1b[2J\x1b[H\x1b[3J slate (AlternateScreen takes over there anyway).
- Default INLINE_MODE on under Termux: primary-buffer rendering makes
  long-thread review and copy/paste much less fragile when users
  background/foreground the app. Override with HERMES_TUI_INLINE=0/1.
- Default mouse tracking off under Termux so touch selection isn't
  intercepted by terminal mouse protocols. Explicit override via
  HERMES_TUI_MOUSE_TRACKING=0/1; legacy HERMES_TUI_DISABLE_MOUSE still
  works on desktop.

Detection is purely env-based (TERMUX_VERSION or PREFIX path) with an
explicit opt-out HERMES_TUI_TERMUX_MODE=0 for debugging. Non-Termux
platforms keep every existing default.

Co-authored-by: adybag14-cyber <252811164+adybag14-cyber@users.noreply.github.com>
@teknium1
teknium1 merged commit 7c2ff74 into main May 19, 2026
11 of 12 checks passed
@teknium1
teknium1 deleted the hermes/hermes-37b74b95 branch May 19, 2026 19:49
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-37b74b95 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8969 on HEAD, 8969 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4724 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

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.

2 participants