mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
XPrompt: fixes a nasty bug in getLastWord
This patch fixes a nasty bug in getLastWord, a bug that causes XMonad to crash as soon as the command line consists of only 2 empty spaces. *PLEASE UPDATE* if you are running XPrompt.
This commit is contained in:
parent
039a76c9cb
commit
990d65eb3e
11
XPrompt.hs
11
XPrompt.hs
@ -166,9 +166,11 @@ eventLoop action = do
|
||||
d <- gets dpy
|
||||
(keysym,string,event) <- io $
|
||||
allocaXEvent $ \e -> do
|
||||
maskEvent d keyPressMask e
|
||||
maskEvent d (exposureMask .|. keyPressMask) e
|
||||
ev <- getEvent e
|
||||
(ks,s) <- lookupString $ asKeyEvent e
|
||||
(ks,s) <- if ev_event_type ev == keyPress
|
||||
then lookupString $ asKeyEvent e
|
||||
else return (Nothing, "")
|
||||
return (ks,s,ev)
|
||||
action (fromMaybe xK_VoidSymbol keysym,string) event
|
||||
|
||||
@ -616,8 +618,9 @@ splitInSubListsAt i x = f : splitInSubListsAt i rest
|
||||
where (f,rest) = splitAt i x
|
||||
|
||||
getLastWord :: String -> String
|
||||
getLastWord [] = []
|
||||
getLastWord c = last . words $ c
|
||||
getLastWord c
|
||||
| c == [] || filter (/=' ') c == [] = []
|
||||
| otherwise = last . words $ c
|
||||
|
||||
skipLastWord :: String -> String
|
||||
skipLastWord [] = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user