aboutsummaryrefslogtreecommitdiffstats
path: root/XPrompt.hs
diff options
context:
space:
mode:
authorValery V. Vorotyntsev <valery.vv@gmail.com>2007-10-20 19:09:36 +0200
committerValery V. Vorotyntsev <valery.vv@gmail.com>2007-10-20 19:09:36 +0200
commitc6daa2a62afab0101a2eba82c38346c4a85ded0d (patch)
tree2efc89f7fd0857c4da8627136a467b3b28aefee2 /XPrompt.hs
parent04e41042fc33168031b1b67bb074e3e405ada5cf (diff)
downloadXMonadContrib-c6daa2a62afab0101a2eba82c38346c4a85ded0d.tar.gz
XMonadContrib-c6daa2a62afab0101a2eba82c38346c4a85ded0d.tar.xz
XMonadContrib-c6daa2a62afab0101a2eba82c38346c4a85ded0d.zip
XPrompt.hs (keyPressHandle): Ctrl-g and Ctrl-c added to quit keystrokes
Obvious comments removed. darcs-hash:20071020170936-ae588-721702bc4e4d6558c54c858f54a6db2238bcbede.gz
Diffstat (limited to '')
-rw-r--r--XPrompt.hs23
1 files changed, 7 insertions, 16 deletions
diff --git a/XPrompt.hs b/XPrompt.hs
index 350c607..99ee2cd 100644
--- a/XPrompt.hs
+++ b/XPrompt.hs
@@ -265,34 +265,25 @@ keyPressHandle :: KeyMask -> KeyStroke -> XP ()
-- commands: ctrl + ... todo
keyPressHandle mask (ks,_)
| mask == controlMask =
+ -- control sequences
case () of
--- ctrl U
_ | ks == xK_u -> killBefore >> go
--- ctrl K
| ks == xK_k -> killAfter >> go
--- ctrl A
| ks == xK_a -> startOfLine >> go
--- ctrl E
| ks == xK_e -> endOfLine >> go
--- Unhandled control sequence
- | otherwise -> eventLoop handle
--- Return: exit
+ | ks == xK_g || ks == xK_c -> quit
+ | otherwise -> eventLoop handle -- unhandled control sequence
| ks == xK_Return = historyPush >> return ()
--- backspace
| ks == xK_BackSpace = deleteString Prev >> go
--- delete
| ks == xK_Delete = deleteString Next >> go
--- left
| ks == xK_Left = moveCursor Prev >> go
--- right
| ks == xK_Right = moveCursor Next >> go
--- up
| ks == xK_Up = moveHistory Prev >> go
--- down
| ks == xK_Down = moveHistory Next >> go
--- escape: exit and discard everything
- | ks == xK_Escape = flushString >> return ()
- where go = updateWindows >> eventLoop handle
+ | ks == xK_Escape = quit
+ where
+ go = updateWindows >> eventLoop handle
+ quit = flushString >> return () -- quit and discard everything
-- insert a character
keyPressHandle _ (_,s)
| s == "" = eventLoop handle