diff options
| author | tv <tv@krebsco.de> | 2017-08-06 23:04:35 +0200 | 
|---|---|---|
| committer | tv <tv@krebsco.de> | 2017-08-06 23:58:41 +0200 | 
| commit | 5e9ee547af994a88da8bbaa638c3e94f16795aac (patch) | |
| tree | 58e4b2ed6516d36786688f3adaf864b3c3b7657b /src/Buffer | |
| parent | 83f37966cf8d1467f748e15b9d73e2597e307bf9 (diff) | |
Buffer.Motion: LeftRightMotion -> Motion
Diffstat (limited to 'src/Buffer')
| -rw-r--r-- | src/Buffer/Motion.hs | 27 | 
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  | 
