[vim/vim] Windows terminal restore screen buffer and stable gui colors (PR #11450)

98 views
Skip to first unread message

Christopher Plewright

unread,
Oct 27, 2022, 1:21:48 AM10/27/22
to vim/vim, Subscribed

Reverted base to patch 814.

resubmitting as new PR. I gotta learn to use git better...

Problem: Vim does not restore the screen buffer corectly on exit in the new Windows Terminal
Solution: CONPTY is now stable, can use the built in alternate screen buffer.

Problem: Windows Terminal had unstable color control, see issue #11373
Solution: Dont try and read the old command prompt colortable, use modern VT sequences instead.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/11450

Commit Summary

  • 00b4045 Fixed 'restorescreen' on exit for Windows Terminal
  • e8a7a72 removed blank lines that werent there before.
  • 03bf31c formatting issues
  • f8b7629 fixed windows terminal color handling and screen restore.
  • 266f7fe RestoreConsoleBuffer needed to return something.
  • 0f3530b inconsistent is_conpty_stable/CONPTY_STABLE variable format.
  • 66dd6b2 define CONPTY_STABLE in the right place
  • 3dab5e8 Update os_win32.c
  • c521862 Update os_win32.c
  • 909d4cd Update os_win32.c

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 1:44:26 AM10/27/22
to vim/vim, Subscribed

@k-takata do the tests just use the changes in my PR, applied to the same faulty 815 in master? If so, then they will still fail, or do the tests somehow also ignore 815?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1293023808@github.com>

K.Takata

unread,
Oct 27, 2022, 5:52:46 AM10/27/22
to vim/vim, Subscribed

Ah, the CI checkouts the code with refs/remotes/pull/11450/merge, so the CI tests the code that is merged with the top of the master branch, which means v9.0.0815 is included.

Sorry for wasting your time. It would be better to rerun the tests after Bram is back.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1293274895@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 6:22:56 AM10/27/22
to vim/vim, Subscribed

OK, thanks, I will dig deeper to see how the testing works, if I can replicate it against my own repo, it could reveal what I want to see for this.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1293313155@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 6:37:57 AM10/27/22
to vim/vim, Push

@zewpo pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11467215796@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 7:16:19 AM10/27/22
to vim/vim, Subscribed

@k-takata all good on my end.
https://github.com/zewpo/vim/actions/runs/3336651545


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1293371759@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 7:18:38 AM10/27/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11467649454@github.com>

Christopher Plewright

unread,
Oct 27, 2022, 4:42:42 PM10/27/22
to vim/vim, Subscribed

closes #11373


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1294040651@github.com>

Christopher Plewright

unread,
Oct 28, 2022, 5:05:16 AM10/28/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • fd09ce9 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11479044361@github.com>

Christopher Plewright

unread,
Oct 28, 2022, 6:43:22 AM10/28/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11480045670@github.com>

Christopher Plewright

unread,
Oct 28, 2022, 6:54:44 AM10/28/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11480154508@github.com>

Christopher Plewright

unread,
Oct 28, 2022, 6:41:33 PM10/28/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 4ab788b Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11486477127@github.com>

codecov[bot]

unread,
Oct 29, 2022, 6:04:13 PM10/29/22
to vim/vim, Subscribed

Codecov Report

Merging #11450 (9da8298) into master (03d6e6f) will decrease coverage by 0.64%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@

##           master   #11450      +/-   ##

==========================================

- Coverage   81.83%   81.19%   -0.65%     

==========================================

  Files         162      152      -10     

  Lines      189739   179638   -10101     

  Branches    43134    40776    -2358     

==========================================

- Hits       155269   145849    -9420     

+ Misses      21896    21096     -800     

- Partials    12574    12693     +119     
Flag Coverage Δ
huge-clang-none 82.72% <50.00%> (-0.01%) ⬇️
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 0.29% <0.00%> (ø)
linux 81.19% <50.00%> (-1.33%) ⬇️
mingw-x64-HUGE ?
mingw-x86-HUGE ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/term.c 73.37% <50.00%> (-0.31%) ⬇️
src/if_perl.xs 54.85% <0.00%> (-17.93%) ⬇️
src/regexp_nfa.c 80.57% <0.00%> (-9.14%) ⬇️
src/arabic.c 85.86% <0.00%> (-8.70%) ⬇️
src/typval.c 84.97% <0.00%> (-8.28%) ⬇️
src/regexp_bt.c 78.48% <0.00%> (-7.48%) ⬇️
src/vim9execute.c 83.14% <0.00%> (-7.16%) ⬇️
src/json.c 77.84% <0.00%> (-5.47%) ⬇️
src/vim9compile.c 87.07% <0.00%> (-4.73%) ⬇️
src/vim9instr.c 77.31% <0.00%> (-4.73%) ⬇️
... and 135 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1295996896@github.com>

Christopher Plewright

unread,
Oct 31, 2022, 7:34:08 PM10/31/22
to vim/vim, Subscribed

Converting this PR to draft.

There is still some incorrect behavior occuring between some combinations of tgc and nors on the various windows terminal consoles.

I'm assuming set nors on windows is supposed to act the same as set t_ti= t_te= on linux. Someone please correct me if I am mistaken.

Well, it is not acting the same as linux in quite a few versions of the windows consoles. I want to make sure it does for this PR, so I will take it out of draft after I have fixed it.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1297814853@github.com>

Christopher Plewright

unread,
Nov 1, 2022, 6:58:22 PM11/1/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • f4961ea CONPTY_STABLE may not be ready. Dont use it yet.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11522712627@github.com>

Christopher Plewright

unread,
Nov 1, 2022, 6:59:30 PM11/1/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 8b8390e Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11522719524@github.com>

Bram Moolenaar

unread,
Nov 1, 2022, 7:19:31 PM11/1/22
to vim/vim, Subscribed

The issue mentions this PR fixes the problem. I'll await it is no longer marked as draft though.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1299346989@github.com>

Christopher Plewright

unread,
Nov 1, 2022, 7:35:43 PM11/1/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • f9f8080 W11 Cmd prompt has new conpty, flag WIN11_OR_LATER

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11522960603@github.com>

Christopher Plewright

unread,
Nov 1, 2022, 7:38:05 PM11/1/22
to vim/vim, Subscribed

@brammool Sorry about all the noise from the CI tests. Every time I do a commit to my own branch, it triggers these in your master vim branch, because of this PR. Lesson learned. Will keep it a bit more quiet after this one.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1299358954@github.com>

Christopher Plewright

unread,
Nov 1, 2022, 7:54:36 PM11/1/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

OK, ready for review


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1164200191@github.com>

Christopher Plewright

unread,
Nov 2, 2022, 3:58:04 AM11/2/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • b3a3df2 revert init vtp after other inits

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11526206700@github.com>

Christopher Plewright

unread,
Nov 2, 2022, 6:07:50 PM11/2/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • df79a4c Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11535231499@github.com>

Christopher Plewright

unread,
Nov 2, 2022, 6:17:01 PM11/2/22
to vim/vim, Push

@zewpo pushed 3 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11535301828@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 8:32:29 AM11/3/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • b2cb384 fixed screen restore for Windows 10 Windows Terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11541734367@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 8:47:10 AM11/3/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

PR ready for review again. Just made another commit, because testing revealed some issues with screen restore still occurred on win 10 - fixed now. tested to be working on win 7, 8, 10, 11 and 11_insider.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1166819511@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 9:28:27 AM11/3/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • f570176 Also fix restore screen for Win10 cmd console.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11542402257@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 9:35:30 AM11/3/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

and.. same fix for windows 10 command prompt. Now command prompts restore nicely on all versions of windows 7,8,10,11 & 11_insider, as well as all windows terminals for win 10, 11 and 11 insider. I cant think of what else to test right now. happy for suggestions.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1166908443@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 7:48:34 PM11/3/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 97dab7d fixed p_tgc[undeclared] & _rgb[unused] TINY compile warnings

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11548521763@github.com>

Christopher Plewright

unread,
Nov 3, 2022, 7:52:17 PM11/3/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

fixed compile TINY; _rgb warnings [-Wunused-variable], and error: 'p_tgc' undeclared


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1167790422@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 7:14:02 AM11/4/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 9262dd1 cross merge #11497 for CI Testing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11553361700@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 7:38:37 AM11/4/22
to vim/vim, Subscribed

This PR #11450 is failing test Test_popup_and_window_resize() on windows HUGE with non-gui vim. But, this test is passing in my dev environment, which is in sync with this PR. I also installed a fresh win2022, and my code is passing this test on that also. So I am not sure how to debug what is happening here in this CI testing. Any suggestions?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1303301987@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 8:49:35 AM11/4/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • d1f6de8 reverting os_win32.c to sanity check CI baseline testing.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11554301858@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 8:58:36 AM11/4/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 1359d71 sanity checking CI testing baseline.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11554400456@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 9:40:27 AM11/4/22
to vim/vim, Push

@zewpo pushed 2 commits.

  • 4bb2ae0 restore only the color fix for this PR
  • 62080f8 undo cross merge changes, irrelevent for this PR

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11554868950@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 9:42:30 AM11/4/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

so... reverted all the screen-restore changes. and just leaving the color fix, to see if that is enough to make CI testing pass.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1168548758@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 11:13:07 AM11/4/22
to vim/vim, Push

@zewpo pushed 2 commits.

  • 964d54c restore more of the fix, see if CI testing is still stable.
  • e7b54c2 restore workaround for windows vtp 10 bug

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11555943014@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 11:33:38 AM11/4/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 0a87322 reverted all of the color fix, and withdrew changes to restorescreen.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11556173384@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 11:38:23 AM11/4/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

OK, so I have simplified this PR, now I'm only submitting changes that fix the color issue. And, I will work on the screen restore separately to tihs PR because it is more complex, and that has been holding me back from finishing this PR.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1168776752@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 6:18:08 PM11/4/22
to vim/vim, Subscribed

I believe this PR is finally ready. I dont know why the macos (huge) build is failing ci test. I dont think that is related to this PR. All other CI tests are now passing.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1304302970@github.com>

Christopher Plewright

unread,
Nov 4, 2022, 7:54:01 PM11/4/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • ac15ccf Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11560149167@github.com>

Christopher Plewright

unread,
Nov 5, 2022, 12:29:36 AM11/5/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • dbe2aef MS-Win Cmd prompt with VTP enabled needs same rgb color flush as WT

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11561171354@github.com>

Christopher Plewright

unread,
Nov 5, 2022, 12:32:44 AM11/5/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

fixed regression of Windows 10 Command Prompt rgb color issue, same as WT fix.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1169311691@github.com>

Christopher Plewright

unread,
Nov 6, 2022, 6:00:17 AM11/6/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 8164aff Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11568145096@github.com>

Christopher Plewright

unread,
Nov 6, 2022, 6:48:35 AM11/6/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • ace9884 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11568344265@github.com>

Christopher Plewright

unread,
Nov 6, 2022, 7:36:22 AM11/6/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 04e56b7 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11568568880@github.com>

Christopher Plewright

unread,
Nov 6, 2022, 6:14:38 PM11/6/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • aaba848 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11571541521@github.com>

Christopher Plewright

unread,
Nov 7, 2022, 4:27:02 PM11/7/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 7b5e731 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11583315865@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 5:27:22 AM11/8/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • 905d6e4 Remove redundant Win 11 checks.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11589717434@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 5:32:49 AM11/8/22
to vim/vim, Subscribed

@zewpo commented on this pull request.

Able to use vtp_working in more places independent of tgc. No need to check for Win 11, because Win 10 behaves the same.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/review/1171849428@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 6:33:11 AM11/8/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11590477947@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 6:53:43 AM11/8/22
to vim/vim, Subscribed

@brammool It's like rolling dice, trying to get all the CI tests to pass. I'm confident this PR is ready to go. It solves the issue linked. Is there anything else you'd like to see done for this PR?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1307087367@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 5:59:27 PM11/8/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • eb0ea10 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11598055814@github.com>

Christopher Plewright

unread,
Nov 8, 2022, 9:54:55 PM11/8/22
to vim/vim, Push

@zewpo pushed 1 commit.

  • e3eafc4 Merge branch 'vim:master' into windows_terminal

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/push/11599603119@github.com>

Bram Moolenaar

unread,
Nov 9, 2022, 6:34:50 PM11/9/22
to vim/vim, Subscribed


> @brammool It's like rolling dice, trying to get all the CI tests to
> pass. I'm confident this PR is ready to go. It solves the issue
> linked. Is there anything else you'd like to see done for this PR?

There are some flaky tests, and it appears MacOS is most sensitive to
them (probably just because those systems are heavily loaded the tests
run a bit slower). I sometimes run tests under valgrind to simulate a
slower system and can tune some wait times, but it's just guessing
really.

You'll have to make a best guess if a PR touches code that might
influence the test that is flaky or fails.

For this PR I can't judge from the code changes what works better.
Others have had chances to comment already, so I think I'll just include
it now and assume that if this causes new problems to be reported we'll
have to reconsider.

--
hundred-and-one symptoms of being an internet addict:
36. You miss more than five meals a week downloading the latest games from
Apogee.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/c1309540867@github.com>

Bram Moolenaar

unread,
Nov 9, 2022, 6:56:33 PM11/9/22
to vim/vim, Subscribed

Closed #11450 via 38804d6.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11450/issue_event/7778296834@github.com>

Reply all
Reply to author
Forward
0 new messages