Pin input prompt to bottom of viewport during scroll (Windows Terminal)
Problem
When running Claude Code CLI in Windows Terminal (started from PowerShell 7.6.0), the input prompt scrolls out of view when the chat buffer exceeds the terminal's visible rows.
Current behavior:
- User receives a long response that exceeds terminal height
- User scrolls up to reference details in the response
- The input prompt disappears from view
- User must mentally retain details, scroll back down, type prompt, and repeat
This creates significant friction when crafting prompts that reference specific details from earlier in the conversation (e.g., line numbers, variable names, error messages).
Expected Behavior
The input prompt should remain pinned to the bottom of the visible viewport while the chat content scrolls independently above it—similar to how vim, nano, less, and other TUI applications handle this.
Proposed Solution
Use ANSI scroll regions to create a fixed input area:
// Set scroll region excluding bottom N lines for input
const rows = process.stdout.rows || 24;
process.stdout.write(`\x1b[1;${rows - 3}r`);
// Content scrolls within lines 1 to (rows-3)
// Input prompt renders in fixed bottom 3 lines
This approach:
- Works in Windows Terminal, iTerm2, and most modern terminal emulators
- Is the standard pattern used by terminal-based editors
- Requires minimal changes to the Ink renderer
Environment
- OS: Windows 11
- Terminal: Windows Terminal
- Shell: PowerShell 7.6.0
- Claude Code: Latest
Workarounds Attempted
- Windows Terminal split panes (
Ctrl+Shift+D) - functional but clunky - PowerShell wrapper setting scroll regions - overridden by Ink's terminal state management
- tmux via WSL - works but adds complexity
Additional Context
This is a common UX pattern request for CLI chat interfaces. The VS Code terminal inline chat solves this elegantly by using a fixed-position widget. For CLI, ANSI scroll regions are the terminal-native equivalent.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗