[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clearing the screen and other such things.



As nearly as I can tell, Common Lisp offers no way to even clear the
screen.  In the absence of a graphics standard, can we commit to even
something so simple as a CLEAR-SCREEN function? In fact, I'd like to see
as many of the functions below as we could agree on; please note that
this suggestion is not meant to preclude a more sophisticated graphics
proposal. It is only meant to acknowledge the fact that many interesting
portable applications can be written using a single fixed width fonts
and character coordinates. Note also that some of these functions might
later want more arguments added, but I've deliberately kept them as simple
as possible for now so as not to preempt decisions that might be made by
the graphics group.
-kmp

 ERASE-SCREEN &optional (screen *TERMINAL-IO*)

  Erases the text on the entire screen. On screens which do not
  support this operation, a fresh-line is done instead.

 ERASE-REST-OF-SCREEN &optional (screen *TERMINAL-IO*)

  Erases the text on the rest of the screen beginning at the point of 
  the cursor. On screens which do not support this operation, a 
  fresh-line is done instead.

 ERASE-REST-OF-LINE &optional (screen *TERMINAL-IO*)

  Clears the rest of the line (from the point of the cursor).
  On screens which do not support this operation, a linefeed is done
  is done instead.

 ERASE-CHAR-BACKWARD &optional (screen *TERMINAL-IO*)

  Erases the character before the cursor. Undefined if called at head 
  of line.

 ERASE-CHAR-FORWARD &optional (screen *TERMINAL-IO*)

  Erases the character after the cursor.  Undefined if called at end 
  of line.

 CURSOR-BACKWARD &optional (screen *TERMINAL-IO*)

  Moves the cursor back one character. Undefined if called at head of 
  line.

 CURSOR-FORWARD &optional (screen *TERMINAL-IO*)

  Moves the cursor forward one character. Undefined if called at end 
  of line.

 CURSOR-DOWN &optional (screen *TERMINAL-IO*)

  Moves the cursor down one character. Undefined if called at bottom 
  of screen.

 CURSOR-UP &optional (screen *TERMINAL-IO*)

  Moves the cursor up one character. Undefined if called at top of 
  screen.

 CURSOR-HOME-UP &optional (screen *TERMINAL-IO*)

  Moves the cursor to the top left corner of the screen. 

 CURSOR-HOME-DOWN &optional (screen *TERMINAL-IO*)

  Moves the cursor to the bottom left corner of the screen.

 INSERT-CHAR &optional (screen *TERMINAL-IO*)

  Opens a position in front of the cursor for display of a character
  using the Insert-Char operation supported by most modern terminals. 
  The effect of INSERT-CHAR when there is a character in the last 
  position on the line is undefined.

 DELETE-CHAR &optional (screen *TERMINAL-IO*)

  Deletes the character in front of the cursor using the standard 
  Delete-Char operation supported by most modern terminals. The effect 
  of DELETE-CHAR at the end of a line is undefined.
 
 INSERT-LINE &optional (screen *TERMINAL-IO*)

  Opens the line at the cursor by sliding the remaining lines on 
  the screen down using the Insert-Line operation supported by most 
  modern terminals.  The effect of calling this when not in column 0 
  is undefined.

 DELETE-LINE &optional (screen *TERMINAL-IO*)

  Deletes the line at the cursor, sliding the remaining lines on the 
  screen up using the standard Delete-Line operation supported by most
  modern terminals. The effect of calling this when not in column 0 
  is undefined.

 CHARACTER-POSITION &optional (screen *TERMINAL-IO*)

  Returns two values representing the character position (X,Y) of the 
  cursor on the given screen in character units (assuming a fixed 
  width font). It should be possible to say 
    (SETF (CHARACTER-POSITION) (VALUES x y)) to
  later restore the cursor to the given coordinates.

 SCREEN-SIZE-IN-CHARACTERS &optional (screen *TERMINAL-IO*)

  Returns two values representing the size of the screen in characters (X,Y).

 SCREEN-OPERATION-HANDLED-P operation &optional (screen *TERMINAL-IO*)

  Takes an argument of the name of a screen operation and returns
  true if that operation is correctly handled on the current screen. eg,
   (SCREEN-OPERATION-HANDLED-P 'DELETE-LINE)
  would be handled only on screens with Delete-Line capability.

  Some operations, such as CLEAR-SCREEN, will be simulated even if this
  returns false. For example, (SCREEN-OPERATION-HANDLED-P 'CLEAR-SCREEN)
  may sometimes return false but the CLEAR-SCREEN operation will never signal
  an error.

 SCREEN-TYPE screen

  Returns a keyword which is one of:

    :DISPLAY	    The screen handles all of the above display operations.
    :CURSOR-MOTION  The screen handles all display operations except the
		    INSERT-xxx and DELETE-xxx operations.
    :GLASS	    The screen handles ERASE-CHARACTER-BACKWARD.
    :PRINTING	    The screen is a paper terminal and handles none of the
		    display operations.
    :OTHER	    The screen is of some type not adequately described by one
		    of these categories. SCREEN-OPERATION-HANDLED-P should be
		    used to determine specifically what type of terminal is involved.