changeset 20183:5888cce49574 v8.2.0647

patch 8.2.0647: MS-Windows: repeat count for events was not used Commit: https://github.com/vim/vim/commit/bc970da80735bfd49c238cdf4bbc60c04dc12e0f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 26 19:00:07 2020 +0200 patch 8.2.0647: MS-Windows: repeat count for events was not used Problem: MS-Windows: repeat count for events was not used. Solution: Check the repeat count. (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/5989)
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Apr 2020 19:15:04 +0200
parents c07406a4d7f1
children 0368f09db11b
files src/os_win32.c src/version.c
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -307,6 +307,7 @@ read_console_input(
     int head;
     int tail;
     int i;
+    static INPUT_RECORD s_irPseudo;
 
     if (nLength == -2)
 	return (s_dwMax > 0) ? TRUE : FALSE;
@@ -354,6 +355,19 @@ read_console_input(
 	}
     }
 
+    if (s_irCache[s_dwIndex].EventType == KEY_EVENT)
+    {
+	if (s_irCache[s_dwIndex].Event.KeyEvent.wRepeatCount > 1)
+	{
+	    s_irPseudo = s_irCache[s_dwIndex];
+	    s_irPseudo.Event.KeyEvent.wRepeatCount = 1;
+	    s_irCache[s_dwIndex].Event.KeyEvent.wRepeatCount--;
+	    *lpBuffer = s_irPseudo;
+	    *lpEvents = 1;
+	    return TRUE;
+	}
+    }
+
     *lpBuffer = s_irCache[s_dwIndex];
     if (!(nLength == -1 || nLength == -2) && ++s_dwIndex >= s_dwMax)
 	s_dwMax = 0;
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    647,
+/**/
     646,
 /**/
     645,