
Terminal Control
****************

This chapter lists the words for performing terminal operations such 
as moving the cursor, inserting or deleting lines, etc.  When writing 
programs you are advised to use only these user interface words.  


User interface words
====================

LEFT moves the cursor one character to the left 

RIGHT Moves the cursor one character to the right 

UP moves the cursor one line up 

DOWN moves the cursor one line down 

KILL-LINE erases from the cursor to the end of the line 

KILL-SCREEN erases from the cursor to the end of the screen 

INSERT-LINE inserts a blank line at the cursor position 

DELETE-LINE deletes the line the cursor is on 

ERASE-SCREEN erases the entire screen 

BEEP rings the bell 

DARK switches to inverse video 

LIGHT switches to normal video 

AT moves the cursor to a specified line and column 

AT? gets the current output-cursor position 

#LINES returns the number of lines on the screen 

#COLUMNS returns the number of columns on the screen 

CURSOR-OFF 

CURSOR-ON 

MARKED switches to 'marked' output i.e.  red-on-white by default.  


Terminals
=========

All user interface terminal words are deferred via the TERMINAL: 
definition itself.  This allowes support for lots of different output 
devices, serial interfaces, WIMP environment, text windows, VT220 
devices can all be supported and are very easy to switch between.  

Just have a look at the defining of a WISE terminal 
'extend.terminal.wyse' : 

    only forth also terminals definitions
    terminal: wyse
    prototype dumb
    for (right         ctl F ;
    for (at            esc Y   swap bl + (emit  bl + (emit  ;
    for (insert-char   esc q    (emit  esc r  ;
    for (delete-char   esc W ;
    for (kill-line     esc K ;
    for (kill-screen   esc k ;
    for (insert-line   esc M ;
    for (delete-line   esc l ;
    for (erase-screen  ctl L ;
    for dark           ctl N ;
    for light          ctl O ;
    : wyse-vp  wyse ;  : wv wyse ;
    only forth also terminals also forth definitions
    : wyse wyse ;
    only forth also definitions

After this you only have to call 
    wise
and all the user interface words all call the wyse functions.  

NOTE: The TERMINAL: will later also include the windowing functions.  
All existing software should also run in the WIMP environment, the new 
functions won't be used in the text environment.  

