Mercurial > vim
comparison src/os_win32.c @ 20051:678cdef2d690 v8.2.0581
patch 8.2.0581: Win32 console: the cursor position is always top-left
Commit: https://github.com/vim/vim/commit/81ccbf199f0d553efdd57bec9bb8e23d91d2fb0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 15 21:05:30 2020 +0200
patch 8.2.0581: Win32 console: the cursor position is always top-left
Problem: Win32 console: the cursor position is always top-left.
Solution: Revert the patch for restoring screen.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 15 Apr 2020 21:15:03 +0200 |
parents | aadd1cae2ff5 |
children | a2124c6d5e6e |
comparison
equal
deleted
inserted
replaced
20050:dcdeba3d62cb | 20051:678cdef2d690 |
---|---|
2610 g_hConIn = GetStdHandle(STD_INPUT_HANDLE); | 2610 g_hConIn = GetStdHandle(STD_INPUT_HANDLE); |
2611 else | 2611 else |
2612 create_conin(); | 2612 create_conin(); |
2613 g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE); | 2613 g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE); |
2614 | 2614 |
2615 vtp_flag_init(); | |
2616 | |
2617 # ifdef FEAT_RESTORE_ORIG_SCREEN | 2615 # ifdef FEAT_RESTORE_ORIG_SCREEN |
2618 // Save the initial console buffer for later restoration | 2616 // Save the initial console buffer for later restoration |
2619 if (vtp_working && p_rs) | |
2620 vtp_printf("\033[?1049h"); | |
2621 SaveConsoleBuffer(&g_cbOrig); | 2617 SaveConsoleBuffer(&g_cbOrig); |
2622 g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes; | 2618 g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes; |
2623 # else | 2619 # else |
2624 // Get current text attributes | 2620 // Get current text attributes |
2625 GetConsoleScreenBufferInfo(g_hConOut, &csbi); | 2621 GetConsoleScreenBufferInfo(g_hConOut, &csbi); |
2673 | 2669 |
2674 # ifdef FEAT_CLIPBOARD | 2670 # ifdef FEAT_CLIPBOARD |
2675 win_clip_init(); | 2671 win_clip_init(); |
2676 # endif | 2672 # endif |
2677 | 2673 |
2674 vtp_flag_init(); | |
2678 vtp_init(); | 2675 vtp_init(); |
2679 } | 2676 } |
2680 | 2677 |
2681 /* | 2678 /* |
2682 * non-GUI version of mch_exit(). | 2679 * non-GUI version of mch_exit(). |
5432 DWORD cmodein; | 5429 DWORD cmodein; |
5433 | 5430 |
5434 if (g_fTermcapMode) | 5431 if (g_fTermcapMode) |
5435 return; | 5432 return; |
5436 | 5433 |
5434 if (!p_rs && USE_VTP) | |
5435 vtp_printf("\033[?1049h"); | |
5436 | |
5437 SaveConsoleBuffer(&g_cbNonTermcap); | 5437 SaveConsoleBuffer(&g_cbNonTermcap); |
5438 | 5438 |
5439 if (g_cbTermcap.IsValid) | 5439 if (g_cbTermcap.IsValid) |
5440 { | 5440 { |
5441 /* | 5441 /* |
5499 cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); | 5499 cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); |
5500 SetConsoleMode(g_hConIn, cmodein); | 5500 SetConsoleMode(g_hConIn, cmodein); |
5501 | 5501 |
5502 # ifdef FEAT_RESTORE_ORIG_SCREEN | 5502 # ifdef FEAT_RESTORE_ORIG_SCREEN |
5503 cb = exiting ? &g_cbOrig : &g_cbNonTermcap; | 5503 cb = exiting ? &g_cbOrig : &g_cbNonTermcap; |
5504 if (!(vtp_working && exiting)) | |
5505 # else | 5504 # else |
5506 cb = &g_cbNonTermcap; | 5505 cb = &g_cbNonTermcap; |
5507 # endif | 5506 # endif |
5508 RestoreConsoleBuffer(cb, p_rs); | 5507 RestoreConsoleBuffer(cb, p_rs); |
5509 restore_console_color_rgb(); | 5508 restore_console_color_rgb(); |
5510 SetConsoleCursorInfo(g_hConOut, &g_cci); | 5509 SetConsoleCursorInfo(g_hConOut, &g_cci); |
5511 | 5510 |
5512 if (p_rs || exiting) | 5511 if (p_rs || exiting) |
5513 { | 5512 { |
5529 if (exiting && !p_rs) | 5528 if (exiting && !p_rs) |
5530 coord.Y--; | 5529 coord.Y--; |
5531 /* | 5530 /* |
5532 * Position the cursor at the leftmost column of the desired row. | 5531 * Position the cursor at the leftmost column of the desired row. |
5533 */ | 5532 */ |
5534 # ifdef FEAT_RESTORE_ORG_SCREEN | 5533 SetConsoleCursorPosition(g_hConOut, coord); |
5535 if (!(vtp_working && exiting)) | 5534 } |
5536 # endif | 5535 |
5537 SetConsoleCursorPosition(g_hConOut, coord); | 5536 if (!p_rs && USE_VTP) |
5538 } | |
5539 | |
5540 # ifdef FEAT_RESTORE_ORIG_SCREEN | |
5541 if (vtp_working && p_rs && exiting) | |
5542 vtp_printf("\033[?1049l"); | 5537 vtp_printf("\033[?1049l"); |
5543 # endif | |
5544 | 5538 |
5545 g_fTermcapMode = FALSE; | 5539 g_fTermcapMode = FALSE; |
5546 } | 5540 } |
5547 #endif // FEAT_GUI_MSWIN | 5541 #endif // FEAT_GUI_MSWIN |
5548 | 5542 |