aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-01-13 17:47:45 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-01-13 17:47:45 +0100
commitecd6ebe1a94c337f69b74d57f8896e97f1561bb0 (patch)
tree6a85d46ff706c0765857676b01c5efbf2df76ba6 /XMonad
parentd3e499ee59fc5a9c2f70d51e6f57f7639214b442 (diff)
downloadXMonadContrib-ecd6ebe1a94c337f69b74d57f8896e97f1561bb0.tar.gz
XMonadContrib-ecd6ebe1a94c337f69b74d57f8896e97f1561bb0.tar.xz
XMonadContrib-ecd6ebe1a94c337f69b74d57f8896e97f1561bb0.zip
Prompt: clean up and optimize moveWord a bit
darcs-hash:20080113164745-32816-611bd85c3966132984e76b1d97e5934d953a796f.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Prompt.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs
index e48b8e1..a50e97b 100644
--- a/XMonad/Prompt.hs
+++ b/XMonad/Prompt.hs
@@ -404,17 +404,13 @@ moveWord d = do
c <- gets command
o <- gets offset
let (f,ss) = splitAt o c
- lp = length . reverse . fst . break isSpace
- ln = length . fst . break isSpace
- prev s = case reverse s of
- ' ':x -> 1 + (lp x)
- x -> lp x
- next s = case s of
- ' ':x -> 1 + (ln x)
- x -> ln x
+ lenToS = length . fst . break isSpace
+ ln p s = case p s of
+ ' ':x -> 1 + lenToS x
+ x -> lenToS x
newoff = case d of
- Prev -> o - prev f
- _ -> o + next ss
+ Prev -> o - (ln reverse f )
+ _ -> o + (ln id ss)
modify $ \s -> s { offset = newoff }
moveHistory :: Direction -> XP ()