microsoft / microsoft/terminal
The SU (scroll up) sequence should pan the viewport down
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version (or Windows build number)
10.0.18363.1500, 1.10.1933.0
### Other Software
_No response_
### Steps to reproduce
1. Open a bash shell in conhost or Windows Terminal.
2. Set the window height to something smallish like 24 rows.
3. Execute the following commands: `for i in {1..100}; do echo $i; done; tput indn 10`
4. Scroll back to view the lines that have been moved off screen.
### Expected Behavior
There should be no gap in the sequence of numbers.
### Actual Behavior
There are numbers missing from the sequence at the point where they've scrolled off screen.

The problem here is that there are two ways in which the `SU` escape sequence is typically implemented in Linux terminals. Most terminals, including XTerm, will pan the viewport down, as if you'd executed a linefeed at the bottom of the window. Lines at the top of the window will be moved into the scrollback buffer, and nothing is lost.
On VTE-based terminals, and Konsole, the `SU` escape sequence will just scroll the buffer contents up, constrained within the visible area. This is equivalent of deleting lines from the top of the window, so anything that scrolls off screen is lost. And that's the behavior that we're currently matching.
From a DEC VT-compatibility point of view, I don't think either interpretation is correct, so that's not a deciding factor. But the reason I think we should be matching XTerm, is because the `indn` terminfo capability is defined as `SU`, and the `ind` capability is defined as a linefeed control, so I think there is an expectation that `indn` should produce the equivalent of multiple linefeeds.
If we aren't going to do that, then we probably shouldn't be using _xterm-256color_ for our `TERM` value.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in conhost or Windows Terminal using the supplied shell commands and a 24-row window, then trace the handling of the SU/indn escape sequence. Done means the resulting numbers have no gap when the viewport is scrolled back, matching the described linefeed-style behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100