From 1be6510aa16cefe17438caf88aa0b74627ae90b6 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 27 Jul 2014 20:58:33 +0200 Subject: constrain MotionCommand in NormalMode --- Main.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Main.hs') 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) -- cgit v1.2.3