diff options
author | tv <tv@shackspace.de> | 2014-07-27 20:58:33 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-07-27 20:58:33 +0200 |
commit | 1be6510aa16cefe17438caf88aa0b74627ae90b6 (patch) | |
tree | 02afab402fe3c883ee2a0d174a036dc89d5fe870 | |
parent | 6160fbfd34179b660586f88d4dec5dfe14173fbf (diff) |
constrain MotionCommand in NormalMode
-rw-r--r-- | Main.hs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -192,8 +192,14 @@ insertChar c (ls, rs) = (ls ++ [c], rs) execCommand :: Command -> ExecM () -execCommand (MotionCommand x) = +execCommand (MotionCommand x) = do modifyBuffer (move x) + -- TODO apply mode constraints somewhere else + q <- get + when (mode q == NormalMode) $ + when (null $ snd $ buffer q) $ + modifyBuffer (gotoLeft 1) + execCommand (InsertChar c) = modifyBuffer (insertChar c) |