fix(tui): termux-gate scrollback preservation, touch-friendly defaults - #28910
Merged
Conversation
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>
Contributor
🔎 Lint report:
|
19 tasks
r266-tech
added a commit
to r266-tech/hermes-agent
that referenced
this pull request
May 20, 2026
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ui-tui/src/lib/termux.ts—isTermuxEnv()(TERMUX_VERSION or Termux PREFIX),isTermuxTuiMode()(defaults on under Termux, opt-out viaHERMES_TUI_TERMUX_MODE=0)ui-tui/src/config/env.ts—TERMUX_TUI_MODEexport;MOUSE_TRACKINGnow supports explicitHERMES_TUI_MOUSE_TRACKING=0/1and defaults off on Termux (legacyHERMES_TUI_DISABLE_MOUSEpreserved off-Termux);INLINE_MODEdefaults on under Termux (override withHERMES_TUI_INLINE=0/1)ui-tui/src/entry.tsx— skip the destructive\x1b[2J\x1b[H\x1b[3Jstartup clear on Termux so prior output stays visible in scrollbackui-tui/src/__tests__/termux.test.ts— 6 unit tests covering the detection + override matrixWhat was dropped from the original PR
TERMUX_HISTORY_MAX=4000and theuseMainApp.tshistory-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 passnpm 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.