Salvaged from #28942 (adybag14-cyber). Only the Ink TUI half is taken here — the bundled "termux compatibility note" added to skills_tool.py in the original PR did not address the actual user-reported bug (skill_matches_platform() filtering Linux skills out on Termux) and also regressed the EXCLUDED_SKILL_DIRS set used to prune nested .venv/site-packages skills. Changes: - ui-tui/src/lib/prompt.ts: single-cell ASCII '>' marker in Termux mode to avoid ambiguous-width glyph artifacts while typing. - ui-tui/src/components/appLayout.tsx: suppress profile prefix on narrow Termux panes (>=90 cols still shows it). - ui-tui/src/lib/inputMetrics.ts + components/messageLine.tsx + lib/virtualHeights.ts: termux-aware transcript body width — drop the desktop 20-col floor on narrow mobile layouts, align virtual heights with actual rendered width. - ui-tui/src/components/textInput.tsx: disable fast-echo bypass by default in Termux to avoid ghosting at soft-wrap boundaries. HERMES_TUI_TERMUX_FAST_ECHO=1 opts back in. Tests: ui-tui/src/__tests__/{prompt,termuxComposerLayout,textInputFastEcho}.test.ts (12 PR-added tests pass; 3 pre-existing wrapAnsi-bundling failures on main are unrelated.) The real skill-listing fix on Termux ('android' platform matching Linux skills) ships as a follow-up commit on this branch.
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
const TERMUX_SAFE_PROMPT = '>'
|
|
|
|
export function composerPromptText(
|
|
prompt: string,
|
|
profileName?: null | string,
|
|
shellMode = false,
|
|
termuxMode = false,
|
|
totalCols?: number
|
|
): string {
|
|
if (shellMode) {
|
|
return '$'
|
|
}
|
|
|
|
if (termuxMode) {
|
|
// Termux fonts/terminal backends can render decorative prompt glyphs with
|
|
// ambiguous width; keep the live composer marker strictly single-cell ASCII
|
|
// so we never leave stale arrow artifacts while typing.
|
|
const basePrompt = TERMUX_SAFE_PROMPT
|
|
|
|
// On very wide panes we can still include profile context. On narrow/mobile
|
|
// panes this burns precious columns and increases wrap/clipping risk.
|
|
const wideEnoughForProfile = typeof totalCols === 'number' ? totalCols >= 90 : false
|
|
if (wideEnoughForProfile && profileName && !['default', 'custom'].includes(profileName)) {
|
|
return `${profileName} ${basePrompt}`
|
|
}
|
|
|
|
return basePrompt
|
|
}
|
|
|
|
if (profileName && !['default', 'custom'].includes(profileName)) {
|
|
return `${profileName} ${prompt}`
|
|
}
|
|
|
|
return prompt
|
|
}
|