microsoft / microsoft/terminal

ED3 in the alt buffer should erase the main scrollback buffer

Open
#3,686 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-VT Issue-Bug Priority-2 Product-Conhost
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

Environment

Windows build number: Version 10.0.18362.356
Also tested with a recent build from source: 171f00c2656731e5ba0185dbbf337389fb7030bd

Steps to reproduce

  1. Start a WSL bash shell in conhost.
  2. Do a long directory listing so you get some content in the backscroll buffer.
  3. Execute this command: printf "\e[?1049h\e[3J\e[?1049l"

That command switches to the alternate buffer (private mode 1049), executes the ED escape sequence with parameter 3 (i.e. erase the scrollback buffer), and then switches back to the main buffer.

Expected behavior

The alternate screen buffer doesn't have a scrollback, so the ED3 sequence should erase the main scrollback buffer. Then when you switch back to the main screen, there should be no scrollback any more.

This is how the command is implemented in XTerm, and most of the other terminal emulators I've tested.

Actual behavior

The main scrollback buffer isn't erased.

This is probably somewhat related to issue #3545. I think the alt screen technically has its own scrollback (even though it's zero length), and it's that empty buffer that is being "erased" when ED3 is executed. It might be better if the alt screen shared the same buffer as the main screen.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in a WSL bash shell under conhost with printf "\e[?1049h\e[3J\e[?1049l", after creating main-screen scrollback with a long directory listing. Trace how the alternate and main screen buffers handle ED parameter 3; done means the main scrollback is empty after returning from the alternate buffer.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.