From e891577f25c620a9726c2e7aa346391e36d8e82d Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Sun, 17 Feb 2008 14:27:34 +0100 Subject: Prompt: regenerate completion list if there's just one completion darcs-hash:20080217132734-32816-89f7cd67e3efb65eb2bbd0b553f04ba8c4fc973b.gz --- XMonad/Prompt.hs | 13 +++++++------ 1 file 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 -- cgit v1.2.3