summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Main.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Main.hs b/Main.hs
index 465610d..2a29fb2 100644
--- a/Main.hs
+++ b/Main.hs
@@ -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)