history: document ANSI escape sequences used
authorPhil Burk <philburk@mobileer.com>
Sun, 26 May 2019 14:06:03 +0000 (07:06 -0700)
committerPhil Burk <philburk@mobileer.com>
Sun, 26 May 2019 14:06:03 +0000 (07:06 -0700)
fth/history.fth
fth/termio.fth

index a61caaa..42c2696 100644 (file)
@@ -51,7 +51,7 @@ KH-HISTORY kh_history_size erase
 \ The most recent entry is put at the beginning,
 \ older entries are shifted up.
 
 \ The most recent entry is put at the beginning,
 \ older entries are shifted up.
 
-4 constant KH_LINE_EXTRA_SIZE ( 2 count bytes plus 2 size bytes )
+4 constant KH_LINE_EXTRA_SIZE ( 2 count bytes plus 2 line_number bytes )
 
 : KH-END ( -- addr , end of history buffer )
     kh-history kh_history_size +
 
 : KH-END ( -- addr , end of history buffer )
     kh-history kh_history_size +
@@ -345,7 +345,6 @@ variable KH-INSIDE        ( true if we are scrolling inside the history buffer )
     ENDCASE
 ;
 
     ENDCASE
 ;
 
-
 : KH.SPECIAL.KEY ( char  -- true | false , handle fkeys or arrows, true if handled )
     true >r
     CASE
 : KH.SPECIAL.KEY ( char  -- true | false , handle fkeys or arrows, true if handled )
     true >r
     CASE
index ab8cc17..fa9682e 100644 (file)
@@ -21,7 +21,18 @@ $ 01 constant ASCII_CTRL_A
 $ 05 constant ASCII_CTRL_E
 $ 18 constant ASCII_CTRL_X
 
 $ 05 constant ASCII_CTRL_E
 $ 18 constant ASCII_CTRL_X
 
-\ ANSI Terminal Control
+\ ANSI arrow key sequences
+\ ESC [ 0x41 is UP
+\ ESC [ 0x42 is DOWN
+\ ESC [ 0x43 is RIGHT
+\ ESC [ 0x44 is LEFT
+
+\ ANSI terminal control
+\ ESC [ 2J is clear screen
+\ ESC [ {n} D is move left
+\ ESC [ {n} C is move right
+\ ESC [ K is erase to end of line
+
 : ESC[ ( send ESCAPE and [ )
     ASCII_ESCAPE emit
     ascii [ emit
 : ESC[ ( send ESCAPE and [ )
     ASCII_ESCAPE emit
     ascii [ emit
@@ -52,7 +63,6 @@ $ 18 constant ASCII_CTRL_X
     ascii K emit
 ;
 
     ascii K emit
 ;
 
-
 : BELL ( -- , ring the terminal bell )
     7 emit
 ;
 : BELL ( -- , ring the terminal bell )
     7 emit
 ;