From 0b4313aa904d59ed44b108baf29f8ebd214e5682 Mon Sep 17 00:00:00 2001
From: tv <tv@krebsco.de>
Date: Sun, 6 Aug 2017 21:39:20 +0200
Subject: Main: \x1b -> \ESC

---
 src/Main.hs | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

(limited to 'src')

diff --git a/src/Main.hs b/src/Main.hs
index af9cf33..d9a8aa1 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -410,7 +410,7 @@ lit = (>>= f)
 
 clearLine :: IO ()
 clearLine =
-    putStr "\x1b[2K" >>
+    putStr "\ESC[2K" >>
     moveCursorLeft 1024
 
 
@@ -419,20 +419,20 @@ ringBell = putStr "\x07" -- BEL '\a'
 
 
 saveCursor :: IO ()
-saveCursor = putStr "\x1b[s"
+saveCursor = putStr "\ESC[s"
 
 unsaveCursor :: IO ()
-unsaveCursor = putStr "\x1b[u"
+unsaveCursor = putStr "\ESC[u"
 
 
 moveCursorLeft :: Int -> IO ()
 moveCursorLeft 0 = return ()
-moveCursorLeft i = putStr $ "\x1b[" ++ show i ++ "D"
+moveCursorLeft i = putStr $ "\ESC[" ++ show i ++ "D"
 
 
 moveCursorRight :: Int -> IO ()
 moveCursorRight 0 = return ()
-moveCursorRight i = putStr $ "\x1b[" ++ show i ++ "C"
+moveCursorRight i = putStr $ "\ESC[" ++ show i ++ "C"
 
 
 -- TODO? charToCode c = "\\x" ++ showHex (ord c)
@@ -442,14 +442,14 @@ charToCode c = "\\x" ++ showIntAtBase 16 intToDigit (ord c) ""
 
 dmap :: Keymap
 dmap =
-  [ ("\x1b", ChangeMode NormalMode)
+  [ ("\ESC", ChangeMode NormalMode)
   , ("d", DeleteEntireLine <> ChangeMode NormalMode)
   ]
 
 
 selectRegisterMap :: Keymap
 selectRegisterMap =
-  [ ("\x1b", ChangeMode NormalMode)
+  [ ("\ESC", ChangeMode NormalMode)
   ]
   ++ (map (\c -> ([c], SetRegister c <> ChangeMode NormalMode))
           (['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ ".%#:-\""))
@@ -457,7 +457,7 @@ selectRegisterMap =
 
 nmap :: Keymap
 nmap =
-  [ ("\x1b", SetCount Nothing)
+  [ ("\ESC", SetCount Nothing)
             -- ^TODO RingBell if count is already Nothing
             --  TODO cancel any unfinished commands
   , ("i", ChangeMode InsertMode <> SetCount Nothing)
@@ -472,8 +472,8 @@ nmap =
   , ("w", MotionCommandWarn WordsForward <> SetCount Nothing)
   , ("d", ChangeMode DeleteMode)
   , ("\"", ChangeMode SelectRegisterMode <> SetCount Nothing)
-  , ("\x1b[C", MotionCommandWarn GotoRight <> SetCount Nothing)
-  , ("\x1b[D", MotionCommandWarn GotoLeft <> SetCount Nothing)
+  , ("\ESC[C", MotionCommandWarn GotoRight <> SetCount Nothing)
+  , ("\ESC[D", MotionCommandWarn GotoLeft <> SetCount Nothing)
   , ("\x0a", ExecuteInputBuffer <> ChangeMode InsertMode <> SetCount Nothing)
   ]
   ++ (map (\i -> (show i, AppendCount i)) [0..9])
@@ -498,19 +498,19 @@ nmap =
 
 imap :: Keymap
 imap =
-  [ ("\x1b", ChangeMode NormalMode <> MotionCommand GotoLeft)
+  [ ("\ESC", ChangeMode NormalMode <> MotionCommand GotoLeft)
   , ("\x01", MotionCommandWarn GotoFirstChar)
   , ("\x05", MotionCommandWarn GotoEndOfLine)
-  , ("\x1b[3~", KillNextChar)
-  , ("\x1b[C", MotionCommandWarn GotoRight)
-  , ("\x1b[D", MotionCommandWarn GotoLeft)
+  , ("\ESC[3~", KillNextChar)
+  , ("\ESC[C", MotionCommandWarn GotoRight)
+  , ("\ESC[D", MotionCommandWarn GotoLeft)
   , ("\x16", ChangeMode VerbatimMode) -- ^V
   , ("\x17", KillLastWord) -- ^W
   , ("\x0a", ExecuteInputBuffer)
   , ("\x7f", KillLastChar) -- Delete
   , ("\x08", KillLastChar) -- BackSpace
-  , ("\x1bOc", MotionCommandWarn WordsForward)
-  , ("\x1bOd", MotionCommandWarn WordsBackward)
+  , ("\ESCOc", MotionCommandWarn WordsForward)
+  , ("\ESCOd", MotionCommandWarn WordsBackward)
   ]
 
 
-- 
cgit v1.2.3