To: vim_dev@googlegroups.com Subject: Patch 8.2.2913 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2913 Problem: MS-Windows conpty supports using mouse events. Solution: When enabling the mouse enable mouse input and disable quick edit mode. (Wez Furlong, closes #8280) Files: src/os_win32.c *** ../vim-8.2.2912/src/os_win32.c 2021-05-20 11:54:07.225060262 +0200 --- src/os_win32.c 2021-05-30 19:22:12.387777022 +0200 *************** *** 1180,1185 **** --- 1180,1187 ---- static int g_nMouseClick = -1; // mouse status static int g_xMouse; // mouse x coordinate static int g_yMouse; // mouse y coordinate + static DWORD g_cmodein = 0; // Original console input mode + static DWORD g_cmodeout = 0; // Original console output mode /* * Enable or disable mouse input *************** *** 1200,1210 **** GetConsoleMode(g_hConIn, &cmodein); if (g_fMouseActive) cmodein |= ENABLE_MOUSE_INPUT; else cmodein &= ~ENABLE_MOUSE_INPUT; ! SetConsoleMode(g_hConIn, cmodein); } --- 1202,1218 ---- GetConsoleMode(g_hConIn, &cmodein); if (g_fMouseActive) + { cmodein |= ENABLE_MOUSE_INPUT; + cmodein &= ~ENABLE_QUICK_EDIT_MODE; + } else + { cmodein &= ~ENABLE_MOUSE_INPUT; + cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE; + } ! SetConsoleMode(g_hConIn, cmodein | ENABLE_EXTENDED_FLAGS); } *************** *** 2782,2789 **** static int g_fWindInitCalled = FALSE; static int g_fTermcapMode = FALSE; static CONSOLE_CURSOR_INFO g_cci; - static DWORD g_cmodein = 0; - static DWORD g_cmodeout = 0; /* * non-GUI version of mch_init(). --- 2790,2795 ---- *************** *** 2924,2930 **** } SetConsoleCursorInfo(g_hConOut, &g_cci); ! SetConsoleMode(g_hConIn, g_cmodein); SetConsoleMode(g_hConOut, g_cmodeout); # ifdef DYNAMIC_GETTEXT --- 2930,2936 ---- } SetConsoleCursorInfo(g_hConOut, &g_cci); ! SetConsoleMode(g_hConIn, g_cmodein | ENABLE_EXTENDED_FLAGS); SetConsoleMode(g_hConOut, g_cmodeout); # ifdef DYNAMIC_GETTEXT *************** *** 3747,3753 **** --- 3753,3766 ---- cmodein &= ~(ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT); if (g_fMouseActive) + { cmodein |= ENABLE_MOUSE_INPUT; + cmodein &= ~ENABLE_QUICK_EDIT_MODE; + } + else + { + cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE; + } cmodeout &= ~( # ifdef FEAT_TERMGUICOLORS // Do not turn off the ENABLE_PROCESSED_OUTPUT flag when using *************** *** 3766,3772 **** cmodeout |= (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); bEnableHandler = FALSE; } ! SetConsoleMode(g_hConIn, cmodein); SetConsoleMode(g_hConOut, cmodeout); SetConsoleCtrlHandler(handler_routine, bEnableHandler); --- 3779,3785 ---- cmodeout |= (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); bEnableHandler = FALSE; } ! SetConsoleMode(g_hConIn, cmodein | ENABLE_EXTENDED_FLAGS); SetConsoleMode(g_hConOut, cmodeout); SetConsoleCtrlHandler(handler_routine, bEnableHandler); *************** *** 5621,5631 **** GetConsoleMode(g_hConIn, &cmodein); if (g_fMouseActive) cmodein |= ENABLE_MOUSE_INPUT; else cmodein &= ~ENABLE_MOUSE_INPUT; cmodein |= ENABLE_WINDOW_INPUT; ! SetConsoleMode(g_hConIn, cmodein); redraw_later_clear(); g_fTermcapMode = TRUE; --- 5634,5650 ---- GetConsoleMode(g_hConIn, &cmodein); if (g_fMouseActive) + { cmodein |= ENABLE_MOUSE_INPUT; + cmodein &= ~ENABLE_QUICK_EDIT_MODE; + } else + { cmodein &= ~ENABLE_MOUSE_INPUT; + cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE; + } cmodein |= ENABLE_WINDOW_INPUT; ! SetConsoleMode(g_hConIn, cmodein | ENABLE_EXTENDED_FLAGS); redraw_later_clear(); g_fTermcapMode = TRUE; *************** *** 5650,5656 **** GetConsoleMode(g_hConIn, &cmodein); cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); ! SetConsoleMode(g_hConIn, cmodein); # ifdef FEAT_RESTORE_ORIG_SCREEN cb = exiting ? &g_cbOrig : &g_cbNonTermcap; --- 5669,5676 ---- GetConsoleMode(g_hConIn, &cmodein); cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); ! cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE; ! SetConsoleMode(g_hConIn, cmodein | ENABLE_EXTENDED_FLAGS); # ifdef FEAT_RESTORE_ORIG_SCREEN cb = exiting ? &g_cbOrig : &g_cbNonTermcap; *** ../vim-8.2.2912/src/version.c 2021-05-30 18:04:14.714468918 +0200 --- src/version.c 2021-05-30 19:24:43.807340353 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2913, /**/ -- My girlfriend told me I should be more affectionate. So I got TWO girlfriends. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///