summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-08-01 12:25:08 +0200
committertv <tv@shackspace.de>2014-08-01 12:25:08 +0200
commit74ecb3f7b885f53e799c020355402c254868a686 (patch)
treece6035ad86b8d52601dddeda0a466c217ee0715a
parent71532ce9d550ba40ef3e8019cc0f93c655792ae6 (diff)
Command += DeleteEntireLine
-rw-r--r--src/Main.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 139b478..11b246c 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -154,6 +154,7 @@ data Command
| MulCount Int
| SetCount Int
| SetRegister Char
+ | DeleteEntireLine
instance Monoid Command where
mempty = Nop
@@ -324,6 +325,18 @@ execCommand (SetCount i) = modify $ \q -> q { count = i }
execCommand (SetRegister c) = modify $ \q -> q { register = c }
+execCommand DeleteEntireLine = modify $ \q ->
+ -- TODO Numbered registers "0 to "9
+ -- Small delete register "-
+ let s = showBuffer $ buffer q
+ r = register q
+ in q { registers = Map.insert r s
+ $ Map.insert defaultRegister
+ $ registers q
+ , buffer = emptyBuffer
+ , register = defaultRegister
+ }
+
reform :: Int -> Char -> String
reform colorCode c =
@@ -422,6 +435,7 @@ charToCode c = "\\x" ++ showIntAtBase 16 intToDigit (ord c) ""
dmap :: Keymap
dmap =
[ ("\x1b", ChangeMode NormalMode)
+ , ("d", DeleteEntireLine <> ChangeMode NormalMode)
]