From 7c19f44a597d4b80bacb6e232049c5dda105853d Mon Sep 17 00:00:00 2001 From: Daniel Schoepe Date: Mon, 28 Sep 2009 11:32:15 +0200 Subject: Correctly check completionKey field in XMonad.Prompt Ignore-this: 99e68a63fe156650cc8e96d31e6d1f5a darcs-hash:20090928093215-7f603-d8026bd2a87e1ca359457e5883f9e59168f83352.gz --- XMonad/Prompt.hs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'XMonad/Prompt.hs') diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index fa0c8f4..56f5770 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -353,22 +353,23 @@ handle _ _ = return () -- completion event handler 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 -> setCommand new_command $ s { offset = length new_command } - updateWins l = do redrawWindows l - eventLoop (completionHandle l) - case c of - [] -> 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 -completionHandle _ ks (KeyEvent {ev_event_type = t, ev_state = m}) - | t == keyPress = keyPressHandle m ks +completionHandle c ks@(sym,_) (KeyEvent { ev_event_type = t, ev_state = m }) = do + complKey <- gets $ completionKey . config + case () of + () | t == keyPress && sym == complKey -> + do + st <- get + let updateState l = + let new_command = nextCompletion (xptype st) (command st) l + in modify $ \s -> setCommand new_command $ s { offset = length new_command } + updateWins l = redrawWindows l >> + eventLoop (completionHandle l) + case c of + [] -> updateWindows >> eventLoop handle + [x] -> updateState [x] >> getCompletions >>= updateWins + l -> updateState l >> updateWins l + | t == keyRelease && sym == complKey -> eventLoop (completionHandle c) + | otherwise -> keyPressHandle m ks -- some other key, handle it normally -- some other event: go back to main loop completionHandle _ k e = handle k e -- cgit v1.2.3