aboutsummaryrefslogtreecommitdiffstats
path: root/XPrompt.hs
diff options
context:
space:
mode:
Diffstat (limited to 'XPrompt.hs')
-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 =