aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt.hs
diff options
context:
space:
mode:
authorDaniel Schoepe <daniel.schoepe@gmail.com>2009-09-28 11:32:15 +0200
committerDaniel Schoepe <daniel.schoepe@gmail.com>2009-09-28 11:32:15 +0200
commit7c19f44a597d4b80bacb6e232049c5dda105853d (patch)
treed2e79e311cb355d9adf6e9d153b9b9a6c9e09d4a /XMonad/Prompt.hs
parent31d5db467ae510b75f2e815eab7042f03e8e37c6 (diff)
downloadXMonadContrib-7c19f44a597d4b80bacb6e232049c5dda105853d.tar.gz
XMonadContrib-7c19f44a597d4b80bacb6e232049c5dda105853d.tar.xz
XMonadContrib-7c19f44a597d4b80bacb6e232049c5dda105853d.zip
Correctly check completionKey field in XMonad.Prompt
Ignore-this: 99e68a63fe156650cc8e96d31e6d1f5a darcs-hash:20090928093215-7f603-d8026bd2a87e1ca359457e5883f9e59168f83352.gz
Diffstat (limited to '')
-rw-r--r--XMonad/Prompt.hs33
1 files changed, 17 insertions, 16 deletions
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