From 11e56650bf0167dc3642610aceb42fbfa9c6b7c1 Mon Sep 17 00:00:00 2001 From: gwern0 Date: Fri, 26 Oct 2007 05:49:20 +0200 Subject: XPrompt.hs: add a pasteString function and keybinding darcs-hash:20071026034920-f7719-a0521e6998e3641deb7a7fc7a733013fcea73b82.gz --- XPrompt.hs | 6 ++++++ 1 file changed, 6 insertions(+) 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 = -- cgit v1.2.3