To: vim_dev@googlegroups.com Subject: Patch 8.2.0547 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0547 Problem: Win32: restoring screen not always done right. Solution: Use a more appropriate method. (Nobuhiro Takasaki, closes #5909) Files: src/os_win32.c *** ../vim-8.2.0546/src/os_win32.c 2020-04-01 18:29:06.525948921 +0200 --- src/os_win32.c 2020-04-11 22:36:30.653650457 +0200 *************** *** 2612,2619 **** --- 2612,2623 ---- create_conin(); g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE); + vtp_flag_init(); + # ifdef FEAT_RESTORE_ORIG_SCREEN // Save the initial console buffer for later restoration + if (vtp_working && p_rs) + vtp_printf("\033[?1049h"); SaveConsoleBuffer(&g_cbOrig); g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes; # else *************** *** 2671,2677 **** win_clip_init(); # endif - vtp_flag_init(); vtp_init(); } --- 2675,2680 ---- *************** *** 5431,5439 **** if (g_fTermcapMode) return; - if (!p_rs && USE_VTP) - vtp_printf("\033[?1049h"); - SaveConsoleBuffer(&g_cbNonTermcap); if (g_cbTermcap.IsValid) --- 5434,5439 ---- *************** *** 5501,5510 **** # ifdef FEAT_RESTORE_ORIG_SCREEN cb = exiting ? &g_cbOrig : &g_cbNonTermcap; # else cb = &g_cbNonTermcap; # endif ! RestoreConsoleBuffer(cb, p_rs); restore_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); --- 5501,5511 ---- # ifdef FEAT_RESTORE_ORIG_SCREEN cb = exiting ? &g_cbOrig : &g_cbNonTermcap; + if (!(vtp_working && exiting)) # else cb = &g_cbNonTermcap; # endif ! RestoreConsoleBuffer(cb, p_rs); restore_console_color_rgb(); SetConsoleCursorInfo(g_hConOut, &g_cci); *************** *** 5530,5540 **** /* * Position the cursor at the leftmost column of the desired row. */ ! SetConsoleCursorPosition(g_hConOut, coord); } ! if (!p_rs && USE_VTP) vtp_printf("\033[?1049l"); g_fTermcapMode = FALSE; } --- 5531,5546 ---- /* * Position the cursor at the leftmost column of the desired row. */ ! # ifdef FEAT_RESTORE_ORG_SCREEN ! if (!(vtp_working && exiting)) ! # endif ! SetConsoleCursorPosition(g_hConOut, coord); } ! # ifdef FEAT_RESTORE_ORIG_SCREEN ! if (vtp_working && p_rs && exiting) vtp_printf("\033[?1049l"); + # endif g_fTermcapMode = FALSE; } *** ../vim-8.2.0546/src/version.c 2020-04-11 22:31:24.058346869 +0200 --- src/version.c 2020-04-11 22:38:18.305408624 +0200 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 547, /**/ -- The MS-Windows registry is no more hostile than any other bunch of state information... that is held in a binary format... a format that nobody understands... and is replicated and cached in a complex and largely undocumented way... and contains large amounts of duplicate and obfuscated information... (Ben Peterson) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///