Skip to content

Instantly share code, notes, and snippets.

@rururutan
Created October 3, 2017 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rururutan/5998ad0a5bb02d7e2352b3974868fcc3 to your computer and use it in GitHub Desktop.
Save rururutan/5998ad0a5bb02d7e2352b3974868fcc3 to your computer and use it in GitHub Desktop.
Disable quick-edit mode when mouse mode is enabled.
--- os_win32.c.org Tue Oct 03 04:54:59 2017
+++ os_win32.c Tue Oct 03 09:01:05 2017
@@ -1068,6 +1068,8 @@
static int g_xMouse; /* mouse x coordinate */
static int g_yMouse; /* mouse y coordinate */
+static DWORD g_cmodein = 0;
+
/*
* Enable or disable mouse input
*/
@@ -1083,9 +1085,17 @@
GetConsoleMode(g_hConIn, &cmodein);
if (g_fMouseActive)
+ {
cmodein |= ENABLE_MOUSE_INPUT;
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein &= ~ENABLE_QUICK_EDIT_MODE;
+ }
else
+ {
cmodein &= ~ENABLE_MOUSE_INPUT;
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein |= ENABLE_QUICK_EDIT_MODE;
+ }
SetConsoleMode(g_hConIn, cmodein);
}
@@ -2499,7 +2509,6 @@
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;
/*
@@ -3810,7 +3819,11 @@
ENABLE_ECHO_INPUT);
#ifdef FEAT_MOUSE
if (g_fMouseActive)
+ {
cmodein |= ENABLE_MOUSE_INPUT;
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein &= ~ENABLE_QUICK_EDIT_MODE;
+ }
#endif
cmodeout &= ~(ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
bEnableHandler = TRUE;
@@ -5460,9 +5473,17 @@
GetConsoleMode(g_hConIn, &cmodein);
#ifdef FEAT_MOUSE
if (g_fMouseActive)
+ {
cmodein |= ENABLE_MOUSE_INPUT;
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein &= ~ENABLE_QUICK_EDIT_MODE;
+ }
else
+ {
cmodein &= ~ENABLE_MOUSE_INPUT;
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein |= ENABLE_QUICK_EDIT_MODE;
+ }
#endif
cmodein |= ENABLE_WINDOW_INPUT;
SetConsoleMode(g_hConIn, cmodein);
@@ -5490,6 +5511,8 @@
GetConsoleMode(g_hConIn, &cmodein);
cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
+ if (g_cmodein & ENABLE_QUICK_EDIT_MODE)
+ cmodein |= ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(g_hConIn, cmodein);
#ifdef FEAT_RESTORE_ORIG_SCREEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment