Text color is not restored on vim exit with TERM=screen.xterm-256color
Steps to reproduce
Log on to remote host, open screen session, edit something in vim. Exit vim and look what is printed in following shell. With the issue, following printing has background color set to mild grey.
The same mild grey is used in editing all existant text; this is also a bit awkward but I donʼt dare yet to call it a real issue.
The issue is overridden either by setting TERM=screen in the screen's subordinate terminal, or by putting set t_Co=16 in .vimrc (got from issue 5346 discussion).
Screenshot of the bad case (konsole window clip):
Expected restored state would have been look like:
Expected behaviour
Active terminal color in following interaction is fully restored.
Version of Vim
9.1
Environment
Local: Kubuntu 22.04.
Remote variant 1 - Ubuntu 24.04:
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 25 2024 10:13:04)
Included patches: 1-16, 647, 678, 697
Modified by [email protected]
Compiled by [email protected]
Remote variant 2 - Amazon Linux, fresh:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 08 2023 00:00:00)
Included patches: 1-2153
Modified by <[email protected]>
Compiled by <[email protected]>
Call path: local konsole (Ubuntu 22.04) -> ssh to remote (TERM=xterm-256color) -> screen (4.09.01 or 4.08.00 respectively); TERM=screen.xterm-256color -> bash -> vim.
Logs and stack traces
No response