summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Main.hs18
1 files changed, 2 insertions, 16 deletions
diff --git a/Main.hs b/Main.hs
index 4f15418..275513c 100644
--- a/Main.hs
+++ b/Main.hs
@@ -114,8 +114,6 @@ uiThread modeRef lock = do
data Command
= AlertBadInput String
| InsertString String
- | InsertNextCharVerbatim
- | InsertStringThenChangeMode String Mode
| KillLastWord
| KillLastChar
| KillNextChar
@@ -211,24 +209,12 @@ execCommand (MotionCommand x) = do
when (null $ snd $ buffer q) $
modifyBuffer (gotoLeft 1)
-
execCommand (ChangeMode m) =
modify $ \ q -> q { mode = m }
execCommand (InsertString s) =
modifyBuffer (insertString s)
-execCommand (InsertStringThenChangeMode s m) =
- modify $ \ q -> q
- { mode = m
- , buffer = insertString s (buffer q)
- }
-
-execCommand InsertNextCharVerbatim =
- modify $ \ q -> q
- { mode = VerbatimMode
- }
-
execCommand ExecuteInputBuffer = do
b <- gets buffer
tell [ "input: <" ++ (concat $ map (reform 32) $ showBuffer b) ++ ">" ]
@@ -383,7 +369,7 @@ imap =
, ("\x1b[3~", KillNextChar)
, ("\x1b[C", MotionCommand $ GotoRight 1)
, ("\x1b[D", MotionCommand $ GotoLeft 1)
- , ("\x16", InsertNextCharVerbatim) -- ^V
+ , ("\x16", ChangeMode VerbatimMode) -- ^V
, ("\x17", KillLastWord) -- ^W
, ("\x0a", ExecuteInputBuffer)
, ("\x7f", KillLastChar) -- Delete
@@ -512,7 +498,7 @@ getCommandXXX keymap defCmd = do
verbatimKeymap :: IO Command
verbatimKeymap = do
c <- getChar
- return $ InsertStringThenChangeMode [c] NormalMode
+ return $ InsertString [c] <> ChangeMode InsertMode
-- TODO Control.Monad.whenLeft