summaryrefslogtreecommitdiffstats
path: root/Buffer/Motion.hs
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-07-28 14:14:07 +0200
committertv <tv@shackspace.de>2014-07-28 14:14:07 +0200
commitc5d13e52aac14c541d00b04fc143fe25ece7bac6 (patch)
tree697178593538a8919bf14318fd1e51a3eec64f36 /Buffer/Motion.hs
parent7687ddd2775d873dc67b243efda981510797549a (diff)
silence all the warnings
Diffstat (limited to 'Buffer/Motion.hs')
-rw-r--r--Buffer/Motion.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Buffer/Motion.hs b/Buffer/Motion.hs
index 86446e0..fa9e059 100644
--- a/Buffer/Motion.hs
+++ b/Buffer/Motion.hs
@@ -25,21 +25,33 @@ data LeftRightMotion
| WordsBackward Int
deriving (Show)
+
-- TODO fail if cannot splitAt properly OR if we didn't modify the buffer
+gotoLeft :: Int -> Buffer -> Buffer
gotoLeft i (ls, rs) =
let (lls, rls) = splitAt (length ls - i) ls in (lls, rls ++ rs)
+
-- TODO fail if cannot splitAt properly OR if we didn't modify the buffer
+gotoRight :: Int -> Buffer -> Buffer
gotoRight i (ls, rs) =
let (lrs, rrs) = splitAt i rs in (ls ++ lrs, rrs)
+
+gotoFirstChar :: Buffer -> Buffer
gotoFirstChar (ls, rs) = ("", ls ++ rs)
+
+gotoEndOfLine :: Buffer -> Buffer
gotoEndOfLine (ls, rs) = (ls ++ rs, "")
+
-- TODO fail if i <= 0 or i > length
+gotoColumn :: Int -> Buffer -> Buffer
gotoColumn i (ls, rs) = splitAt (i - 1) $ ls ++ rs
+
+wordsForward :: Int -> Buffer -> Buffer
wordsForward i (ls, rs) =
let rs' = dropWhile (==' ') $ dropWhile (/=' ') rs
ls' = ls ++ take (length rs - length rs') rs
@@ -49,6 +61,8 @@ wordsForward i (ls, rs) =
then wordsForward (i - 1) b'
else b'
+
+wordsBackward :: Int -> Buffer -> Buffer
wordsBackward i (ls, rs) =
let ls' = dropWhileEnd (/=' ') $ dropWhileEnd (==' ') ls
rs' = drop (length ls') ls ++ rs