From 57f49d6e57adb6f20fe3f461c47dd7be02ff5fb5 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Mon, 17 Dec 2007 23:29:30 +0100 Subject: Util/Search.hs: a few updates/fixes * fix shadowing warning (ghc 6.8.2 complains) * export a few more of the functions * re-de-obfuscate generated URLs by not escaping alphanumerics or punct. darcs-hash:20071217222930-bd4d7-6b3809c471754bb03ad6f3658f9e8c7c7d2865a2.gz --- XMonad/Util/Search.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'XMonad/Util') diff --git a/XMonad/Util/Search.hs b/XMonad/Util/Search.hs index c20ff1f..03e6992 100644 --- a/XMonad/Util/Search.hs +++ b/XMonad/Util/Search.hs @@ -17,10 +17,13 @@ module XMonad.Util.Search ( -- * Usage -- $usage google, googleSelection, + googleSearch, wayback, waybackSelection, + waybackSearch, wikipedia, wikipediaSelection, + wikipediaSearch, promptSearch, search ) where @@ -30,7 +33,7 @@ import XMonad.Util.Run (safeSpawn) import XMonad.Prompt.Shell (getShellCompl) import XMonad.Prompt (XPrompt(showXPrompt), mkXPrompt, XPConfig()) import XMonad.Util.XSelection (getSelection) -import Data.Char (chr, ord) +import Data.Char (chr, ord, isAlpha, isMark, isDigit) import Numeric (showIntAtBase) -- A customized prompt @@ -42,7 +45,7 @@ instance XPrompt Search where -- Note that everything is escaped; we could be smarter and use 'isAllowedInURI' -- but then that'd be hard enough to copy-and-paste we'd need to depend on 'network'. escape :: String -> String -escape = escapeURIString (const False) +escape = escapeURIString (\c -> isAlpha c || isDigit c || isMark c) where escapeURIString :: (Char -> Bool) -- ^ a predicate which returns 'False' @@ -59,7 +62,7 @@ escape = escapeURIString (const False) myShowHex :: Int -> ShowS myShowHex n r = case showIntAtBase 16 (toChrHex) n r of [] -> "00" - [c] -> ['0',c] + [ch] -> ['0',ch] cs -> cs toChrHex d | d < 10 = chr (ord '0' + fromIntegral d) -- cgit v1.2.3