[PATCH 2/3] kernel32: Reset the Insert key toggle state after new Insert Mode settings are applied, if the Insert key toggle is active

Hugh McMaster hugh.mcmaster at outlook.com
Wed Aug 5 00:12:10 CDT 2015


---
 dlls/kernel32/editline.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/editline.c b/dlls/kernel32/editline.c
index 667c27a..4a0cded 100644
--- a/dlls/kernel32/editline.c
+++ b/dlls/kernel32/editline.c
@@ -913,7 +913,7 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, BOOL can_pos_cursor)
     const KeyEntry*	ke;
     unsigned		ofs;
     void		(*func)(struct WCEL_Context* ctx);
-    DWORD               mode, ks;
+    DWORD               mode, orig_mode, ks;
     int                 use_emacs;
 
     memset(&ctx, 0, sizeof(ctx));
@@ -928,6 +928,7 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, BOOL can_pos_cursor)
 	!GetConsoleScreenBufferInfo(ctx.hConOut, &ctx.csbi))
 	return NULL;
     if (!GetConsoleMode(hConsoleIn, &mode)) mode = 0;
+    orig_mode = mode;
     ctx.shall_echo = (mode & ENABLE_ECHO_INPUT) ? 1 : 0;
     ctx.insert = (mode & (ENABLE_INSERT_MODE|ENABLE_EXTENDED_FLAGS)) == (ENABLE_INSERT_MODE|ENABLE_EXTENDED_FLAGS);
     if (!GetConsoleMode(ctx.hConOut, &mode)) mode = 0;
@@ -984,6 +985,12 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, BOOL can_pos_cursor)
         GetConsoleMode(hConsoleIn, &mode);
         ctx.insert = (mode & (ENABLE_INSERT_MODE|ENABLE_EXTENDED_FLAGS)) ==
                      (ENABLE_INSERT_MODE|ENABLE_EXTENDED_FLAGS);
+        if (orig_mode != mode)
+        {
+            orig_mode = mode;
+            if (ctx.insertkey)
+                ctx.insertkey = 0;
+        }
         if (ctx.insertkey)
             ctx.insert = !ctx.insert;
 
-- 
1.9.1




More information about the wine-patches mailing list