XPrompt.hs: add a pasteString function and keybinding

This commit is contained in:
gwern0
2007-10-26 03:49:20 +00:00
parent 630166f9fa
commit 89ffbc20a1

View File

@@ -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 =