X.U.EZConfig: Force readKeySequence to consume the whole input

When users specify non-existent keys, it seems most intuitive to just
abort the parse and not try to take the "longest" input that still
works.  For example, given the "key" `M-10` we should signal a parse
error (by returning `Nothing`) instead of parsing `M-1` and ignoring
the rest of the input.  The old EZConfig parser accounted for this but
when the module was rewritten to use X.U.Parser in [1], this was
forgotten about.

Fixes: https://github.com/xmonad/xmonad/issues/361

[1]: 8abeb81fd0
This commit is contained in:
slotThe
2022-01-05 14:59:51 +01:00
parent 28d86f3a28
commit 0a6048c66d
2 changed files with 6 additions and 1 deletions

View File

@@ -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]