Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class SSHRunner {

// Exit alternate screen buffer before attaching
process.stdout.write("\x1b[?1049l")
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?25h")

const sshArgs = [
Expand All @@ -159,7 +159,7 @@ export class SSHRunner {

child.on("exit", () => {
// Clear screen and re-enter alternate buffer for TUI
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?1049h")
process.stdout.write("\x1b]0;Agent View\x07")
})
Expand All @@ -175,7 +175,7 @@ export class SSHRunner {

// Exit alternate screen buffer
process.stdout.write("\x1b[?1049l")
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?25h")

const sshArgs = [
Expand Down Expand Up @@ -207,7 +207,7 @@ export class SSHRunner {
}

// Clear screen and re-enter alternate buffer for TUI
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?1049h")
process.stdout.write("\x1b]0;Agent View\x07")

Expand Down
6 changes: 4 additions & 2 deletions src/core/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ bind-key -n C-t if-shell "[ $(tmux display -p '#{window_panes}') -eq 1 ]" "split
bind-key -n C-o select-pane -t :.+

# Session switching (no prefix needed)
bind-key -n C-] switch-client -n
bind-key -n 'C-\' switch-client -p
# refresh-client after switch forces a full terminal redraw to prevent
# screen artifacts from the previous session.
bind-key -n C-] switch-client -n \; refresh-client
bind-key -n 'C-\' switch-client -p \; refresh-client
bind-key -n C-l run-shell "touch /tmp/agent-view-session-list" \; detach-client

# --- Status bar ---
Expand Down
10 changes: 5 additions & 5 deletions src/core/tmux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ export async function attachWithPty(sessionName: string): Promise<void> {
// PTY may already be closed
}

// Clear screen before returning to TUI
process.stdout.write("\x1b[2J\x1b[H")
// Clear screen + scrollback before returning to TUI
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
}
})
}
Expand Down Expand Up @@ -698,7 +698,7 @@ export function attachSessionSync(sessionName: string): void {

// Exit alternate screen buffer (TUI uses this)
process.stdout.write("\x1b[?1049l")
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H") // Clear screen + scrollback
process.stdout.write("\x1b[?25h")

// Attach to tmux - this blocks until user detaches (Ctrl+Q or Ctrl+B d)
Expand All @@ -707,8 +707,8 @@ export function attachSessionSync(sessionName: string): void {
env: process.env
})

// Clear screen and re-enter alternate buffer for TUI
process.stdout.write("\x1b[2J\x1b[H")
// Clear screen + scrollback and re-enter alternate buffer for TUI
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?1049h")

// Restore terminal title to "Agent View"
Expand Down
4 changes: 2 additions & 2 deletions src/core/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function performUpdateSync(): void {

// Exit alternate screen buffer
process.stdout.write("\x1b[?1049l")
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?25h")

spawnSync("bash", ["-c", "curl -fsSL https://raw.githubusercontent.com/frayo44/agent-view/main/install.sh | bash"], {
Expand All @@ -61,7 +61,7 @@ export function performUpdateSync(): void {
})

// Clear screen and re-enter alternate buffer for TUI
process.stdout.write("\x1b[2J\x1b[H")
process.stdout.write("\x1b[2J\x1b[3J\x1b[H")
process.stdout.write("\x1b[?1049h")

// Restore terminal title
Expand Down