diff options
author | tv <tv@shackspace.de> | 2014-07-28 00:20:41 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-07-28 00:20:41 +0200 |
commit | baff597a7b274db01419e4b4a0ba3f428c78d288 (patch) | |
tree | 93581d2ba452a49a1eac3ce25add4c2afb74c95a | |
parent | 983f4007620c1c7c0d2c50892d08a367f7152c0a (diff) |
s/([iI]nsert)Char/\1String/
-rw-r--r-- | Main.hs | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -103,9 +103,9 @@ uiThread modeRef lock = do data Command = AlertBadInput String - | InsertChar Char + | InsertString String | InsertNextCharVerbatim - | InsertCharThenChangeMode Char Mode + | InsertStringThenChangeMode String Mode | KillLastWord | KillLastChar | KillNextChar @@ -187,7 +187,7 @@ runExecCommand st (ExecM ex) = -insertChar c (ls, rs) = (ls ++ [c], rs) +insertString s (ls, rs) = (ls ++ s, rs) execCommand :: Command -> ExecM () @@ -201,16 +201,16 @@ execCommand (MotionCommand x) = do modifyBuffer (gotoLeft 1) -execCommand (InsertChar c) = - modifyBuffer (insertChar c) - execCommand (ChangeMode m) = modify $ \ q -> q { mode = m } -execCommand (InsertCharThenChangeMode c m) = +execCommand (InsertString s) = + modifyBuffer (insertString s) + +execCommand (InsertStringThenChangeMode s m) = modify $ \ q -> q { mode = m - , buffer = insertChar c (buffer q) + , buffer = insertString s (buffer q) } execCommand InsertNextCharVerbatim = @@ -459,7 +459,7 @@ instance Show Mode where getCommand :: Mode -> IO Command -getCommand InsertMode = getMappedCommand imap InsertChar +getCommand InsertMode = getMappedCommand imap (InsertString . (:[])) getCommand NormalMode = getMappedCommand nmap (AlertBadInput . (:[])) getCommand VerbatimMode = verbatimKeymap @@ -490,8 +490,7 @@ getMappedCommand xs defCmd = do verbatimKeymap :: IO Command verbatimKeymap = do c <- getChar - --return $ InsertCharThenChangeMode c defaultGetCommand - return $ InsertCharThenChangeMode c NormalMode + return $ InsertStringThenChangeMode [c] NormalMode -- TODO Control.Monad.whenLeft |