diff options
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 14 |
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) ] |