From 59a17bcb6c9671f0b22d66b56575aab2b334727d Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Thu, 15 Nov 2007 20:10:12 +0100 Subject: Prompt: just code formatting darcs-hash:20071115191012-32816-ff1d5fdd9df9a69f84bfccd84a83637a2a9b26a5.gz --- XMonad/Prompt.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'XMonad/Prompt.hs') diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index c2fc75a..8de97bb 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -286,8 +286,8 @@ keyPressHandle mask (ks,_) | ks == xK_Right = moveCursor Next >> go | ks == xK_Up = moveHistory Prev >> go | ks == xK_Down = moveHistory Next >> go - | ks == xK_Home = startOfLine >> go - | ks == xK_End = endOfLine >> go + | ks == xK_Home = startOfLine >> go + | ks == xK_End = endOfLine >> go | ks == xK_Escape = quit where go = updateWindows >> eventLoop handle @@ -331,7 +331,7 @@ killWord d = do -- | Put the cursor at the end of line endOfLine :: XP () endOfLine = - modify $ \s -> s { offset = length (command s) } + modify $ \s -> s { offset = length (command s)} -- | Put the cursor at the start of line startOfLine :: XP () @@ -341,12 +341,12 @@ startOfLine = -- | Flush the command string and reset the offest flushString :: XP () flushString = do - modify (\s -> s { command = "", offset = 0} ) + modify $ \s -> s { command = "", offset = 0} -- | Insert a character at the cursor position insertString :: String -> XP () insertString str = - modify (\s -> s { command = c (command s) (offset s), offset = o (offset s)} ) + modify $ \s -> s { command = c (command s) (offset s), offset = o (offset s)} where o oo = oo + length str c oc oo | oo >= length oc = oc ++ str | otherwise = f ++ str ++ ss @@ -359,7 +359,7 @@ pasteString = join $ io $ liftM insertString $ getSelection -- | Remove a character at the cursor position deleteString :: Direction -> XP () deleteString d = - modify (\s -> s { command = c (command s) (offset s), offset = o (offset s)} ) + modify $ \s -> s { command = c (command s) (offset s), offset = o (offset s)} where o oo = if d == Prev then max 0 (oo - 1) else oo c oc oo | oo >= length oc && d == Prev = take (oo - 1) oc @@ -371,7 +371,7 @@ deleteString d = -- | move the cursor one position moveCursor :: Direction -> XP () moveCursor d = - modify (\s -> s { offset = o (offset s) (command s)} ) + modify $ \s -> s { offset = o (offset s) (command s)} where o oo c = if d == Prev then max 0 (oo - 1) else min (length c) (oo + 1) moveHistory :: Direction -> XP () @@ -384,7 +384,7 @@ moveHistory d = do Prev -> h !! (if (i + 1) > (length h - 1) then 0 else i + 1) Next -> h !! (max (i - 1) 0) Nothing -> str - modify (\s -> s { command = nc, offset = length nc }) + modify $ \s -> s { command = nc, offset = length nc} -- X Stuff -- cgit v1.2.3