github / github/copilot-cli

[BUG]: Terminal output overwrites lines in place instead of appending to scrollback

Aperta
#3,110 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
area:terminal-rendering
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

## Description

The CLI renders output using cursor-movement/overwrite sequences that rewrite lines in place on the normal screen buffer, rather than printing linearly. As a result, **no output from the current session ever enters the terminal scrollback buffer** — it is simply overwritten and lost.

This affects all output: responses, tables, code blocks, and reasoning/thinking text. The only content visible when scrolling up is content from *before* the current CLI session started.

## Steps to Reproduce

1. Open a terminal with unlimited scrollback (e.g. iTerm2 with "Save lines to scrollback in alternate screen mode" enabled)
2. Start a Copilot CLI session
3. Ask Copilot to output something long — e.g. a 40-row table
4. Only the portion visible on screen at render time is visible; nothing appears in scrollback
5. Run `/clear` and scroll up — only pre-session content is visible; the entire current session is gone

## Expected Behavior

Output should be printed linearly so that it accumulates in the terminal scrollback buffer like any standard CLI tool (e.g. `git log`, `curl`, etc.).

## Actual Behavior

Output is rendered using in-place cursor movement sequences. Nothing from the current session appears in the scrollback buffer, regardless of scrollback size or terminal settings.

## Impact

- Long responses or tables are truncated to whatever fits on screen — the rest is permanently lost
- There is no way to review earlier turns in the current session by scrolling up
- `/clear` provides no benefit since the current session was never in scrollback to begin with
- Workarounds like iTerm2's alternate screen scrollback setting have no effect

## Environment

- CLI version: 1.0.40
- OS: macOS (Darwin)
- Terminal: iTerm2 with unlimited scrollback and alternate screen scrollback enabled
- Shell: zsh

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reproducing the issue in the Copilot CLI with a long response and `/clear`, then trace the terminal rendering path that emits cursor-movement and overwrite sequences. Done means current-session output is printed linearly and remains available in terminal scrollback, including long responses, tables, code blocks, and reasoning text.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
shell
Ambito
cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.