summaryrefslogtreecommitdiffstats
path: root/src/Buffer/Motion.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Buffer/Motion.hs')
-rw-r--r--src/Buffer/Motion.hs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/Buffer/Motion.hs b/src/Buffer/Motion.hs
index 1333b78..8e59789 100644
--- a/src/Buffer/Motion.hs
+++ b/src/Buffer/Motion.hs
@@ -3,18 +3,15 @@ module Buffer.Motion where
import Data.List (dropWhileEnd)
import Buffer.Class
---data Motion = Motion Int LeftRightMotion
-
-
-- TODO factor Count
-- TODO various Vim gX
-data LeftRightMotion
- = GotoLeft
- | GotoRight
- | GotoFirstChar
+data Motion
+ = CharsBackward
+ | CharsForward
+ | ToStartOfLine
-- | GotoFirstNonBlankChar
- | GotoEndOfLine -- XXX in Vi this can go downwards
- | GotoColumn
+ | ToEndOfLine -- XXX in Vi this can go downwards
+ | ToColumn
-- | GotoFindLeft (Char -> Bool) -- TODO don't use functions here
-- | GotoFindRight (Char -> Bool) -- TODO ^ dto.
-- | GotillFindLeft Char
@@ -73,11 +70,11 @@ wordsBackward i (ls, rs) =
else b'
-move :: LeftRightMotion -> Int -> Buffer -> Buffer
-move GotoLeft c = gotoLeft c
-move GotoRight c = gotoRight c
-move GotoFirstChar _ = gotoFirstChar -- TODO use count
-move GotoEndOfLine _ = gotoEndOfLine -- TODO use count
-move GotoColumn c = gotoColumn c
+move :: Motion -> Int -> Buffer -> Buffer
+move CharsBackward c = gotoLeft c
+move CharsForward c = gotoRight c
+move ToStartOfLine _ = gotoFirstChar -- TODO use count
+move ToEndOfLine _ = gotoEndOfLine -- TODO use count
+move ToColumn c = gotoColumn c
move WordsForward c = wordsForward c
move WordsBackward c = wordsBackward c