aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-17 14:27:34 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-17 14:27:34 +0100
commite891577f25c620a9726c2e7aa346391e36d8e82d (patch)
tree21e880317b45ed2521c47f97cca1bb2f4c604ce3
parent06632cd0a3089b9697bf7ceefa2dc92d3ec331fd (diff)
downloadXMonadContrib-e891577f25c620a9726c2e7aa346391e36d8e82d.tar.gz
XMonadContrib-e891577f25c620a9726c2e7aa346391e36d8e82d.tar.xz
XMonadContrib-e891577f25c620a9726c2e7aa346391e36d8e82d.zip
Prompt: regenerate completion list if there's just one completion
darcs-hash:20080217132734-32816-89f7cd67e3efb65eb2bbd0b553f04ba8c4fc973b.gz
-rw-r--r--XMonad/Prompt.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs
index 74dbfe7..349d8c0 100644
--- a/XMonad/Prompt.hs
+++ b/XMonad/Prompt.hs
@@ -283,13 +283,14 @@ completionHandle :: [String] -> KeyStroke -> Event -> XP ()
completionHandle c (ks,_) (KeyEvent {ev_event_type = t})
| t == keyPress && ks == xK_Tab = do
st <- get
+ let updateState l = do let new_command = nextCompletion (xptype st) (command st) l
+ modify $ \s -> s { command = new_command, offset = length new_command }
+ updateWins l = do redrawWindows l
+ eventLoop (completionHandle l)
case c of
- [] -> do updateWindows
- eventLoop handle
- l -> do let new_command = nextCompletion (xptype st) (command st) l
- modify $ \s -> s { command = new_command, offset = length new_command }
- redrawWindows c
- eventLoop (completionHandle c)
+ [] -> updateWindows >> eventLoop handle
+ [x] -> updateState [x] >> getCompletions >>= updateWins
+ l -> updateState l >> updateWins l
-- key release
| t == keyRelease && ks == xK_Tab = eventLoop (completionHandle c)
-- other keys