diff --git a/XMonad/Util/EZConfig.hs b/XMonad/Util/EZConfig.hs index 847b0dd7..71e54f09 100644 --- a/XMonad/Util/EZConfig.hs +++ b/XMonad/Util/EZConfig.hs @@ -412,7 +412,7 @@ readKeymap c = mapMaybe (maybeKeys . first (readKeySequence c)) -- | Parse a sequence of keys, returning Nothing if there is -- a parse failure (no parse, or ambiguous parse). readKeySequence :: XConfig l -> String -> Maybe [(KeyMask, KeySym)] -readKeySequence c = runParser (parseKeySequence c) +readKeySequence c = runParser (parseKeySequence c <* eof) -- | Parse a sequence of key combinations separated by spaces, e.g. -- @\"M-c x C-S-2\"@ (mod+c, x, ctrl+shift+2). diff --git a/tests/EZConfig.hs b/tests/EZConfig.hs index c7e3408a..5b677b50 100644 --- a/tests/EZConfig.hs +++ b/tests/EZConfig.hs @@ -25,6 +25,11 @@ spec = do , mod2Mask, mod3Mask, mod4Mask, mod5Mask ]] + -- Checking for regressions + describe "readKeySequence" $ + it "Fails on the non-existent key M-10" $ + readKeySequence def "M-10" `shouldBe` Nothing + regularKeys :: ([String], [KeySym]) regularKeys = unzip . map (first (: "")) $ zip ['!' .. '~' ] [xK_exclam .. xK_asciitilde]