Closed GoogleCodeExporter closed 8 years ago
I can reproduce the same bug with xmonad-0.10-3 from ubuntu 12.0 by running
shellPrompt and typing any character with code greater than 0x100 (utf-8
locale), for example "ы".
Original comment by manpac...@gmail.com
on 17 Jun 2012 at 1:04
That's right, utf-8 symbols in Prompt reproduces that error.
Original comment by smp...@gmail.com
on 18 Jun 2012 at 8:37
Right, the problem is that lookupString already returns keypresses which are
already in proper unicode and whoever implemented utf8-string library decided
not to use any checks if string is in unicode format already and some other guy
who implemented Xmonad.Prompt decided that he can assume that color passed
into initColor will be always correct and yet one more guy decided that
catching any exceptions inside that initColor function and returning Nothing
should be safe - because of all this (and some haskell lazyness) we have a
nice, clean and 100% unrelated error message about this pattern match.
So if you are affected by that bug and looking for a quick fix - just go into
XMonad.Prompt module, look for keyPressHandle function, look for decodeString
near insertString call and just remove that decodeString part.
Original comment by manpac...@gmail.com
on 23 Jul 2012 at 1:29
I wanna that fix to be done in some future xmonad releases.
Original comment by smp...@gmail.com
on 23 Jul 2012 at 5:09
I remove 'decodeString', but it does not fix problem:
keyPressHandle :: KeyMask -> KeyStroke -> XP ()
keyPressHandle m (ks,str) = do
km <- gets (promptKeymap . config)
kmask <- cleanMask m -- mask is defined in ghc7
case M.lookup (kmask,ks) km of
Just action -> action >> updateWindows
Nothing -> case str of
"" -> eventLoop handle
_ -> when (kmask .&. controlMask == 0) $ do
insertString (decodeString str)
updateWindows
completed <- tryAutoComplete
when completed $ setSuccess True >> setDone True
to
keyPressHandle :: KeyMask -> KeyStroke -> XP ()
keyPressHandle m (ks,str) = do
km <- gets (promptKeymap . config)
kmask <- cleanMask m -- mask is defined in ghc7
case M.lookup (kmask,ks) km of
Just action -> action >> updateWindows
Nothing -> case str of
"" -> eventLoop handle
_ -> when (kmask .&. controlMask == 0) $ do
insertString str
updateWindows
completed <- tryAutoComplete
when completed $ setSuccess True >> setDone True
Please, fix this bug!!
Original comment by d...@krylov.ws
on 26 Aug 2012 at 5:17
> I remove 'decodeString', but it does not fix problem:
sorry, it's need to call "xmonad --recompile" too.
Now this patch work!
Original comment by d...@mycareermap.ru
on 27 Aug 2012 at 9:11
Has anyone but dima tested this?
Original comment by gwe...@gmail.com
on 7 Sep 2012 at 3:37
Can we merge this fix into main repo? Or at least check whole situation with
handling input with encodings other than lower part of ASCII - mostly utf8.
Original comment by manpac...@gmail.com
on 29 Oct 2012 at 5:50
I came to the same solution independently. Works fine here (ghc-7.6,
en_US.UTF-8 locale). I think it's peekCString doing all the hard work:
> peekCStringLen s = getForeignEncoding >>= flip GHC.peekCStringLen s
Original comment by polac...@gmail.com
on 14 Dec 2012 at 3:42
Attachments:
Original comment by vogt.a...@gmail.com
on 14 Dec 2012 at 4:30
Original comment by vogt.a...@gmail.com
on 26 Dec 2012 at 1:32
Original issue reported on code.google.com by
smp...@gmail.com
on 3 Jun 2012 at 3:02