feat: toggle between picker and grid without closing panes

Add pause()/resume() to DirectGridRenderer that detach/reattach frame
listeners without killing captures or PTY sessions. switchToPicker now
pauses the grid, switchToGrid resumes it. Panes keep running in the
background while browsing the project list.

Footer shows "t grid" hint when panes are active in the background.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-28 09:56:38 +00:00
parent 61add15531
commit bc8a0c1934
4 changed files with 37 additions and 5 deletions

View File

@@ -89,6 +89,31 @@ export class DirectGridRenderer {
this.writeRaw(SHOW_CURSOR)
}
pause() {
this.running = false
if (this.titleTimer) { clearInterval(this.titleTimer); this.titleTimer = null }
// Detach frame listeners (stops rendering) but keep captures alive
for (const p of this.panes) p.directPane.detach()
}
resume() {
this.running = true
this.writeRaw(HIDE_CURSOR + CLEAR)
// Reattach frame listeners and redraw
for (let i = 0; i < this.panes.length; i++) {
const p = this.panes[i]
const dp = p.directPane
const idx = i
dp.attach(p.session.name)
dp.onFrame = (lines) => {
if (!this.running) return
this.drawPane(idx, lines)
}
}
this.repositionAll()
this.titleTimer = setInterval(() => this.refreshTitles(), 1000)
}
// ─── Getters ───────────────────────────────────────────
get focusIndex() { return this._focusIndex }