-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Describe the bug
If the terminal uses 24-bit color before starting vim, the colors are not restored correctly.
This happens because vim uses screen scraping to save the screen and those legacy console apis do not support 24-bit color.
One possible fix is to use the alternate screen buffer. I tried this myself and it seems to work. It also seems to be what the Linux version of vim does as the problem does not reproduce if you run vim from WSL.
To Reproduce
Detailed steps to reproduce the behavior:
- Ensure the terminal displays some 24-bit color, e.g. run this PowerShell script
- Run vim.exe
- Exit
Expected behavior
The screen is restored without colors changing.
Environment (please complete the following information):
- Vim version 8.1
- OS: Windows 10 1903
- Terminal: Windows Terminal
Additional context
My screen shots demonstrate a possible (minimally tested) fix. I'm guessing a better fix is possible though, maybe using a non-Windows code path.

