aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgwern0 <gwern0@gmail.com>2007-10-19 03:00:57 +0200
committergwern0 <gwern0@gmail.com>2007-10-19 03:00:57 +0200
commit24f22c3a558181ac176c28f8ca836db6d51b011b (patch)
treeb997a9af01e811cd11f030289496adbf0b33b10a
parent4bd882120d6012fc0b247562da29b938e826a50a (diff)
downloadXMonadContrib-24f22c3a558181ac176c28f8ca836db6d51b011b.tar.gz
XMonadContrib-24f22c3a558181ac176c28f8ca836db6d51b011b.tar.xz
XMonadContrib-24f22c3a558181ac176c28f8ca836db6d51b011b.zip
XSelection.hs: documentation format changes.
darcs-hash:20071019010057-f7719-5decc9a8f35769e90dd5cb1de30eba76f4c8fb24.gz
-rw-r--r--XSelection.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/XSelection.hs b/XSelection.hs
index a2132d1..80353a8 100644
--- a/XSelection.hs
+++ b/XSelection.hs
@@ -58,8 +58,8 @@ import Foreign (Word8(), (.&.), shiftL, (.|.))
* Possibly add some more elaborate functionality: Emacs' registers are nice.
-}
--- | Returns a String corresponding to the current mouse selection in X; if there is none, an empty string is returned.. Note that this is
--- only reliable for ASCII text and currently mangles\/escapes more complex UTF-8 characters.
+-- | Returns a String corresponding to the current mouse selection in X; if there is none, an empty string is returned. Note that this is
+-- really only reliable for ASCII text and currently escapes or otherwise mangles more complex UTF-8 characters.
getSelection :: IO String
getSelection = do
dpy <- openDisplay ""
@@ -121,9 +121,10 @@ putSelection text = do
print ev
processEvent dpy ty text e
--- | A wrapper around getSelection. Makes it convenient to run a program with the current selection as an argument. This is convenient
--- for handling URLs, in particular. For example, in your Config.hs you could bind a key to @promptSelection \"firefox\"@; this would allow you to
--- highlight a URL string and then immediately open it up in Firefox.
+{- | A wrapper around getSelection. Makes it convenient to run a program with the current selection as an argument.
+This is convenient for handling URLs, in particular. For example, in your Config.hs you could bind a key to
+ @promptSelection \"firefox\"@;
+this would allow you to highlight a URL string and then immediately open it up in Firefox. -}
promptSelection :: String -> X ()
promptSelection app = spawn . ((app ++ " ") ++) =<< io getSelection
@@ -155,9 +156,7 @@ decode (c:cs)
(acc < 0xd800 || 0xdfff < acc) &&
(acc < 0xfffe || 0xffff < acc) = chr acc : decode rs
| otherwise = replacement_character : decode rs
-
aux n (r:rs) acc
| r .&. 0xc0 == 0x80 = aux (n-1) rs
$ shiftL acc 6 .|. fromEnum (r .&. 0x3f)
-
aux _ rs _ = replacement_character : decode rs