diff --git a/win32/editline.c b/win32/editline.c
index 0abdda491d504b0db7326313514de1006cf3bd5b..bbace28b80a76c9f5ed0f6e287fa80521f7b6575 100644
--- a/win32/editline.c
+++ b/win32/editline.c
@@ -632,6 +632,7 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, int use_emacs)
     KeyEntry*		ke;
     unsigned		ofs;
     void		(*func)(struct WCEL_Context* ctx);
+    DWORD               ks;
 
     memset(&ctx, 0, sizeof(ctx));
     ctx.hConIn = hConsoleIn;
@@ -659,11 +660,13 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, int use_emacs)
 
 /* EPP 	WCEL_Dump(&ctx, "before func"); */
 	ofs = ctx.ofs;
+        /* mask out some bits which don't interest us */
+        ks = ir.Event.KeyEvent.dwControlKeyState & ~(NUMLOCK_ON|SCROLLLOCK_ON|CAPSLOCK_ON);
 
 	func = NULL;
 	for (km = (use_emacs) ? EmacsKeyMap : Win32KeyMap; km->entries != NULL; km++)
 	{	
-	    if (km->keyState != ir.Event.KeyEvent.dwControlKeyState)
+	    if (km->keyState != ks)
 		continue;
 	    if (km->chkChar)
 	    {