diff options
author | David Roundy <droundy@darcs.net> | 2007-11-14 15:21:27 +0100 |
---|---|---|
committer | David Roundy <droundy@darcs.net> | 2007-11-14 15:21:27 +0100 |
commit | b0abc42e285f47e5eedf191b84319fa0460c00e3 (patch) | |
tree | 4b629b1a6817b46a683abd9940227e438a83c840 /XMonad/Config | |
parent | 70fb3f6a92169f3396e0dd3ed0e8601e06684613 (diff) | |
download | XMonadContrib-b0abc42e285f47e5eedf191b84319fa0460c00e3.tar.gz XMonadContrib-b0abc42e285f47e5eedf191b84319fa0460c00e3.tar.xz XMonadContrib-b0abc42e285f47e5eedf191b84319fa0460c00e3.zip |
improve shrinking in Droundy.hs
darcs-hash:20071114142127-72aca-bd932e519c8b5efcb60cd9239d2a1c039da080de.gz
Diffstat (limited to 'XMonad/Config')
-rw-r--r-- | XMonad/Config/Droundy.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/XMonad/Config/Droundy.hs b/XMonad/Config/Droundy.hs index 27e1987..126a2ef 100644 --- a/XMonad/Config/Droundy.hs +++ b/XMonad/Config/Droundy.hs @@ -133,8 +133,12 @@ config = defaultConfig mytab = tabbed CustomShrink defaultTConf instance Shrinker CustomShrink where + shrinkIt shr s | Just s' <- dropFromHead " " s = shrinkIt shr s' shrinkIt shr s | Just s' <- dropFromTail " " s = shrinkIt shr s' shrinkIt shr s | Just s' <- dropFromTail "- Iceweasel" s = shrinkIt shr s' + shrinkIt shr s | Just s' <- dropFromTail "- KPDF" s = shrinkIt shr s' + shrinkIt shr s | Just s' <- dropFromHead "file://" s = shrinkIt shr s' + shrinkIt shr s | Just s' <- dropFromHead "http://" s = shrinkIt shr s' shrinkIt _ s | n > 9 = s : map cut [2..(halfn-3)] ++ shrinkIt shrinkText s where n = length s halfn = n `div` 2 @@ -145,3 +149,7 @@ instance Shrinker CustomShrink where dropFromTail :: String -> String -> Maybe String dropFromTail t s | drop (length s - length t) s == t = Just $ take (length s - length t) s | otherwise = Nothing + +dropFromHead :: String -> String -> Maybe String +dropFromHead h s | take (length h) s == h = Just $ drop (length h) s + | otherwise = Nothing |