fix: PTY stdin error, double-click select with full buffer, alt+key passthrough

- Remove proc.stdin.on() call (Bun FileSink has no .on method), add
  try/catch and proc.killed guards to write/resize
- Double-click enters select mode instead of shift+click, with yellow
  banner and Esc-to-exit hint for discoverability
- Select mode now dumps full scrollback buffer (up to 5000 lines) so
  users can scroll up and copy old conversation text
- Pass all Alt+key combos through input parser to PTY (fixes
  Alt+Backspace word deletion and other Alt shortcuts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-28 17:54:41 +00:00
parent 059004b6f2
commit 9cf18f5740
5 changed files with 114 additions and 24 deletions

View File

@@ -195,6 +195,14 @@ class VtScreen {
}
}
// Get full buffer: all scrollback lines + current screen (for select mode)
getAllLines(): string[] {
const lines: string[] = []
for (const row of this.scrollback) lines.push(this.renderRow(row))
for (let r = 0; r < this.height; r++) lines.push(this.renderRow(this.cells[r]))
return lines
}
// Get screen as lines with embedded ANSI SGR codes (like tmux capture-pane -e)
// When scrollOffset > 0, shows scrollback history mixed with screen content
getLines(): string[] {
@@ -613,6 +621,12 @@ export function getLatestFrame(sessionName: string): CaptureResult | null {
}
}
export function getFullBuffer(sessionName: string): string[] | null {
const state = panes.get(sessionName)
if (!state) return null
return state.screen.getAllLines()
}
export function stopCapture(sessionName: string): void {
const state = panes.get(sessionName)
if (!state) return