Skip to content

fix(terminal): size rows to the visible viewport - #48

Merged
ZacharyZcR merged 1 commit into
Termix-SSH:dev-1.5.0from
ZacharyZcR:fix/terminal-viewport-sizing
Aug 12, 2026
Merged

fix(terminal): size rows to the visible viewport#48
ZacharyZcR merged 1 commit into
Termix-SSH:dev-1.5.0from
ZacharyZcR:fix/terminal-viewport-sizing

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Summary

  • measure the actual React Native terminal viewport height
  • apply that height inside the WebView instead of relying on stale WKWebView 100vh
  • refit xterm and resize the PTY after chrome, keyboard, or orientation changes
  • debounce animated layout changes to avoid resize storms
  • preserve the scroll-to-bottom position when appropriate

This extracts the viewport-sizing fix from #39 onto dev-1.5.0. The original commit remains authored by Tink (goxofy). Touch scrolling is intentionally handled separately.

Verification

  • npx tsc --noEmit
  • targeted ESLint (0 errors; existing warnings only)
  • npm run format:check
  • git diff --check

Partially supersedes #39.

TUI apps (Claude Code, Codex, vim, htop) draw their bottom input row at
the pty's last row. The WebView was sized by marginBottom so it spans only
the visible area, but xterm computed rows from #terminal's 100vh CSS height,
which WKWebView reports stale after a frame resize. The pty told the shell
too many rows, so TUIs painted their input row behind the keyboard bar.

Measure the real visible height with onLayout, push it into the WebView
(debounced to avoid resize storms), pin #terminal's height to it, then fit
and re-send the pty resize. Re-apply on terminalReady and prefer the pinned
height in nativeFit/resize over the stale 100vh.

Co-Authored-By: Claude <noreply@anthropic.com>
@ZacharyZcR
ZacharyZcR merged commit b433e32 into Termix-SSH:dev-1.5.0 Aug 12, 2026
2 checks passed
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.

1 participant