microsoft / microsoft/terminal

Flickering in conhost when scrolling top part of screen

Open
#11,274 2 comments 0 reactions 0 assignees View on GitHub
Area-Rendering Issue-Bug Priority-2 Product-Conhost
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version (or Windows build number)

Version 10.0.18363.1500

### Other Software

_No response_

### Steps to reproduce

1. Open a bash shell in conhost.
2. In the console properties, make sure you've got a large buffer size (e.g. height 9000).
3. Press enter a few times until you've filled the screen with content.
4. Execute `printf "\e[1;12r"` to set the scrolling margins to the top half of the screen.
5. Execute `for i in {1..1000}; do printf "\n"; done` to force the top half of the screen to scroll.

### Expected Behavior

The top half should scroll away and then remain blank until the prompt reappears. The bottom half should remain unchanged.

### Actual Behavior

The bottom half of the screen jumps up and down while the top half is scrolling

https://user-images.githubusercontent.com/4181424/133927374-76882356-391b-4dfd-88c4-58d8d6a3af1f.mp4

The way the scrolling is implemented (as I understand it), the bottom half of the screen is moved down, and then the whole viewport is also panned down. This should have the effect of keeping the bottom half constant, while the top half is scrolled up into the scrollback buffer.

However, it looks like the viewport pan takes effect before the bottom half of the screen is refreshed, so it initially appears to be scrolling up before it's redrawn in the correct place. Once the scrollback buffer is filled, though, this is no longer a problem. I assume that's because the scrolling is achieved by cycling the buffer instead of panning the viewport.

Also note that the DX renderer doesn't seem to have this problem (tested with the `UseDx` registry setting in a recent build of OpenConsole).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in conhost with a large buffer and the provided scrolling-margin commands. Compare the scrolling behavior with the DX renderer; done means the top half scrolls without flickering or moving the unchanged bottom half.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.