aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgwern0 <gwern0@gmail.com>2007-10-26 05:49:20 +0200
committergwern0 <gwern0@gmail.com>2007-10-26 05:49:20 +0200
commit11e56650bf0167dc3642610aceb42fbfa9c6b7c1 (patch)
tree32bdc58c9a4b119052609daf83c1ed46a4fe7d2e
parent0a9150fb620b032351a4f7c6dfd698de980a7fa2 (diff)
downloadXMonadContrib-11e56650bf0167dc3642610aceb42fbfa9c6b7c1.tar.gz
XMonadContrib-11e56650bf0167dc3642610aceb42fbfa9c6b7c1.tar.xz
XMonadContrib-11e56650bf0167dc3642610aceb42fbfa9c6b7c1.zip
XPrompt.hs: add a pasteString function and keybinding
darcs-hash:20071026034920-f7719-a0521e6998e3641deb7a7fc7a733013fcea73b82.gz
-rw-r--r--XPrompt.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/XPrompt.hs b/XPrompt.hs
index f75ddd9..ddb2639 100644
--- a/XPrompt.hs
+++ b/XPrompt.hs
@@ -47,6 +47,7 @@ import XMonad hiding (io)
import Operations (initColor)
import qualified StackSet as W
import XMonadContrib.XUtils
+import XMonadContrib.XSelection (getSelection)
import Control.Arrow ((***),(&&&))
import Control.Monad.Reader
@@ -273,6 +274,7 @@ keyPressHandle mask (ks,_)
| ks == xK_k -> killAfter >> go
| ks == xK_a -> startOfLine >> go
| ks == xK_e -> endOfLine >> go
+ | ks == xK_y -> pasteString >> go
| ks == xK_g || ks == xK_c -> quit
| otherwise -> eventLoop handle -- unhandled control sequence
| ks == xK_Return = historyPush >> return ()
@@ -330,6 +332,10 @@ insertString str =
| otherwise = f ++ str ++ ss
where (f,ss) = splitAt oo oc
+-- | Insert the current X selection string at the cursor position.
+pasteString :: XP ()
+pasteString = join $ io $ liftM insertString $ getSelection
+
-- | Remove a character at the cursor position
deleteString :: Direction -> XP ()
deleteString d =