Scrolling down in VIM scrolls up duplicated vim status lines #7189

Closed
opened 2026-01-31 00:57:21 +00:00 by claunia · 9 comments
Owner

Originally created by @0xd4d on GitHub (Mar 28, 2020).

Originally assigned to: @DHowett-MSFT on GitHub.

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.720]   
Windows Terminal version (if applicable): 0.10.781.0

vim for Windows (official git build): VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 16 2020 08:26:10)

Steps to reproduce

  • Start vim: vim (the one that comes with git version 2.26.0.windows.1)
  • Press i
  • Press ENTER until it starts scrolling the screen
  • (to exit vim): ESC and then type :q! and then ENTER 😄

Expected behavior

The status line stays where it's supposed to be, at the bottom of the screen.

Actual behavior

Every time a the screen is scrolled down, the last line (white status line) is scrolled up, and a new white status line is printed at the bottom. This results in two white lines, then 3, etc...

This does not reproduce if I use the old cmd.exe (started by eg. Explorer, not wt.exe)

Originally created by @0xd4d on GitHub (Mar 28, 2020). Originally assigned to: @DHowett-MSFT on GitHub. # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18363.720] Windows Terminal version (if applicable): 0.10.781.0 vim for Windows (official git build): VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 16 2020 08:26:10) ``` # Steps to reproduce - Start vim: `vim` (the one that comes with `git version 2.26.0.windows.1`) - Press `i` - Press `ENTER` until it starts scrolling the screen - (to exit vim): `ESC` and then type `:q!` and then `ENTER` 😄 # Expected behavior The status line stays where it's supposed to be, at the bottom of the screen. # Actual behavior Every time a the screen is scrolled down, the last line (white status line) is scrolled up, and a new white status line is printed at the bottom. This results in two white lines, then 3, etc... This does not reproduce if I use the old cmd.exe (started by eg. Explorer, not wt.exe)
claunia added the Area-OutputResolution-Fix-CommittedIssue-BugProduct-Conpty labels 2026-01-31 00:57:21 +00:00
Author
Owner

@avysk commented on GitHub (Mar 29, 2020):

I can reproduce this with vim which comes with git; if I use vim-tux build from chocolatey, it works normally.

@avysk commented on GitHub (Mar 29, 2020): I can reproduce this with vim which comes with git; if I use vim-tux build from chocolatey, it works normally.
Author
Owner

@0xd4d commented on GitHub (Mar 31, 2020):

Does vim-tux have a status line with a white background? If it's the same color as the background, you won't see it.

@0xd4d commented on GitHub (Mar 31, 2020): Does vim-tux have a status line with a white background? If it's the same color as the background, you won't see it.
Author
Owner

@avysk commented on GitHub (Mar 31, 2020):

Does vim-tux have a status line with a white background?

Yes.

image

EDIT: I can be wrong. I have number and rnu set; setting them in git vim manually prevents the problem from reproducing. I'll try if I can reproduce this in vim-tux without those settings.

EDIT2 I cannot reproduce problem In vim-tux just by commenting out set number and set rnu in my config.

EDIT3 I have tried to remove my vim settings completely and run vim-tux as vim -u "C:\Program Files\Git\etc\vimrc" -- the problem is not reproducible.

@avysk commented on GitHub (Mar 31, 2020): > Does vim-tux have a status line with a white background? Yes. ![image](https://user-images.githubusercontent.com/130091/78058330-cec93880-7390-11ea-9dfc-104746c30bf6.png) **EDIT: I can be wrong.** I have `number` and `rnu` set; setting them in git vim manually prevents the problem from reproducing. I'll try if I can reproduce this in vim-tux without those settings. **EDIT2** I cannot reproduce problem In vim-tux just by commenting out `set number` and `set rnu` in my config. **EDIT3** I have tried to remove my vim settings completely and run vim-tux as `vim -u "C:\Program Files\Git\etc\vimrc"` -- the problem is not reproducible.
Author
Owner

@avysk commented on GitHub (Mar 31, 2020):

...and here's git vim (notice that it's broken in some other way as well):
image

@avysk commented on GitHub (Mar 31, 2020): ...and here's git vim (notice that it's broken in some other way as well): ![image](https://user-images.githubusercontent.com/130091/78058456-fddfaa00-7390-11ea-866a-d7338e7cbfb3.png)
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 3, 2020):

Well would you look at that, it reproduces immediately.

The behavior is slightly different on 0.11-pre: the line occasionally flickers, or the cursor jumps below the line, but it doesn't get copied onto the screen repeatedly. It's probably impacted by #5181.

Idly, I wonder if this bug will go away when git-for-windows updates to cygwin >3.1, which changes how VT is parsed.

@DHowett-MSFT commented on GitHub (Apr 3, 2020): Well would you look at that, it reproduces immediately. The behavior is slightly different on 0.11-pre: the line occasionally flickers, or the cursor jumps below the line, but it doesn't get copied onto the screen repeatedly. It's probably impacted by #5181. Idly, I wonder if this bug will go away when git-for-windows updates to cygwin >3.1, which changes how VT is parsed.
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 3, 2020):

@zadjii-msft this is one to keep an eye on: Git Vim isn't using vt, but this seems like another deferred newline issue. It looks like it's fixed with #5181, but I only have your not-latest changes and we need to make sure it doesn't regress.

Simple repro: run \program files\git\bin\bash -li then vim. press i and hit enter until it goes off the bottom of the screen.

0.10 pty tap on top, 0.11 on bottom

                                       BAD LF HERE, no other diff
                                       V
␛[m␛[?25l␛[30;1H␛[?25h␛[?25l␛[30m␛[107m␊␛[m␛[28;1H␛[30m␛[107m␍␊[No␣Name][+]␣[unix]␣(15:59␣31/12/1969)␣␣␣␣␣␣␣␣␣␣␣␣30,1␣Bot␛[97m␛[49m--␣INSERT␣--␛[K␛[28;1H␛[?25h
␛[m␛[?25l␛[30;1H␛[?25h␛[?25l␛[30m␛[107m␛[m␛[28;1H␛[30m␛[107m␍␊[No␣Name][+]␣[unix]␣(15:59␣31/12/1969)␣␣␣␣␣␣␣␣␣␣␣␣30,1␣Bot␛[97m␛[49m--␣INSERT␣--␛[K␛[28;1H␛[?25h

weird thing is, it prints the lf before it goes and strikes the status line again...

@DHowett-MSFT commented on GitHub (Apr 3, 2020): @zadjii-msft this is one to keep an eye on: Git Vim isn't _using_ vt, but this seems like another deferred newline issue. It looks like it's fixed with #5181, but I only have your not-latest changes and we need to make sure it doesn't regress. Simple repro: run `\program files\git\bin\bash -li` then `vim`. press `i` and hit enter until it goes off the bottom of the screen. 0.10 pty tap on top, 0.11 on bottom ``` BAD LF HERE, no other diff V ␛[m␛[?25l␛[30;1H␛[?25h␛[?25l␛[30m␛[107m␊␛[m␛[28;1H␛[30m␛[107m␍␊[No␣Name][+]␣[unix]␣(15:59␣31/12/1969)␣␣␣␣␣␣␣␣␣␣␣␣30,1␣Bot␛[97m␛[49m--␣INSERT␣--␛[K␛[28;1H␛[?25h ␛[m␛[?25l␛[30;1H␛[?25h␛[?25l␛[30m␛[107m␛[m␛[28;1H␛[30m␛[107m␍␊[No␣Name][+]␣[unix]␣(15:59␣31/12/1969)␣␣␣␣␣␣␣␣␣␣␣␣30,1␣Bot␛[97m␛[49m--␣INSERT␣--␛[K␛[28;1H␛[?25h ``` weird thing is, it prints the lf before it goes and strikes the status line again...
Author
Owner

@zadjii-msft commented on GitHub (Apr 3, 2020):

Oh shoot this isn't fixed in my latest changes, but I'll try and make a repro case for this.


EDIT: I think this is because we're newlining to add a new row, then moving the cursor to the line the old status bar is on, then we're not clearing it, because the the bottom line is new (_newBottomLine=true), and then we're moving down to the new location of the status bar, printing that, then printing the INSERT line.


EDIT2: Okay I've got what I think is a patch for this, but I'm not sure that it doesn't make things horribly worse:

Change the init of removeSpaces in VtEngine::_PaintUtf8BufferLine to the following:

    const bool removeSpaces = (useEraseChar || (_clearedAllThisFrame) || (_newBottomLine && coord.Y == _lastViewport.BottomInclusive()));

and the problem goes away. Now I just need to write a test for this, and validate the other tests don't regress too.

@zadjii-msft commented on GitHub (Apr 3, 2020): Oh shoot this isn't fixed in my latest changes, but I'll try and make a repro case for this. <hr> EDIT: I think this is because we're newlining to add a new row, then moving the cursor to the line the old status bar is on, then we're _not_ clearing it, because the the bottom line is new (`_newBottomLine=true`), and then we're moving down to the new location of the status bar, printing that, then printing the `INSERT` line. <hr> EDIT2: Okay I've got what I think is a patch for this, but I'm not sure that it doesn't make things horribly worse: Change the init of `removeSpaces` in `VtEngine::_PaintUtf8BufferLine` to the following: ```c++ const bool removeSpaces = (useEraseChar || (_clearedAllThisFrame) || (_newBottomLine && coord.Y == _lastViewport.BottomInclusive())); ``` and the problem goes away. Now I just need to write a test for this, and validate the other tests don't regress too.
Author
Owner

@PistachioCake commented on GitHub (Apr 3, 2020):

I'm so glad I found this here, I've been trying to solve this for weeks and am new to the whole open-source thing 😅

To add: I could not reproduce this issue using Ubuntu WSL and its associated vim (version 8.0.1453), but it does occur in git bash with its associated vim (version 8.1.2292). It does not occur when either are run as individual processes, not through Windows Terminal.

@PistachioCake commented on GitHub (Apr 3, 2020): I'm so glad I found this here, I've been trying to solve this for weeks and am new to the whole open-source thing 😅 To add: I could not reproduce this issue using Ubuntu WSL and its associated vim (version 8.0.1453), but it does occur in git bash with its associated vim (version 8.1.2292). It does not occur when either are run as individual processes, not through Windows Terminal.
Author
Owner

@ghost commented on GitHub (Apr 22, 2020):

:tada:This issue was addressed in #5181, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.🎉

Handy links:

@ghost commented on GitHub (Apr 22, 2020): :tada:This issue was addressed in #5181, which has now been successfully released as `Windows Terminal Preview v0.11.1121.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.11.1121.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7189