From: Mr MP Soysa
Subject: "Clear screen / goto (x,y).. please help
Date: 
Message-ID: <3nuusl$rsk@harbinger.cc.monash.edu.au>
Could some one please tell me the format directives or
commands to move the cursor to some point in the screen
or alternatively to clear the screen and go to the top ?

I need this for a simulation display.

Thanks

Manjuka

······@ccds.cc.monash.edu.au

From: Marty Hall
Subject: Re: "Clear screen / goto (x,y).. please help
Date: 
Message-ID: <D7x1Ir.DrC@aplcenmp.apl.jhu.edu>
In article <··········@harbinger.cc.monash.edu.au> ······@mdw053.cc.monash.edu.au (Mr MP Soysa) writes:
>Could some one please tell me the format directives or
>commands to move the cursor to some point in the screen
>or alternatively to clear the screen and go to the top ?

This depends on your terminal type. You can just generate and print
the ESC sequences your terminal wants. Eg here are two simple examples
that work on a VT200 that I made for my students. I'm not aware of a
curses-like interface that works for multiple terminal types or that
tries to parse the /etc/termcap file (on UNIX). I use the nonstandard
#\Escape, which several Lisps support. You could use (code-char 27)
instead, assuming ASCII.

;;; Operation		Command
;;; ================+================
;;; Clear Screen        ESC[2JESC[H
;;; Up N lines          ESC[NA       ; N is a variable
;;; Down N lines        ESC[NB       ; N is a variable
;;; Right N cols        ESC[NC       ; N is a variable
;;; Left N cols		ESC[ND       ; N is a variable
;;; Move cursor to
;;;   line L, col C     ESC[L;CH     ; L, C are variables
;;;
;;; Note that #\Escape is the character for ESC in Lisp; you
;;; can use (setf (aref <String> <Position>) #\Escape) to stick it in, or
;;; use (format nil ...) to construct the string. See two examples below,
;;; one doing it each way.
;;; 1995 Marty Hall. ··········@jhuapl.edu
;;;======================================================================

;;;======================================================================
;;; Defines a Clear-Screen function for vt100 terminals.
;;; Note that this does not work if running Lisp within emacs, only
;;; from a tty in vtxxx mode. You could put a real escape character in
;;; the file instead of sticking it in the string at run-time, but that
;;; would make it hard to view and print the source code.

(defun Clear-Screen ()
  "Clear the screen on a vt100 terminal. Don't use from within emacs."
  (let ((String " [2J [H"))
    (setf (aref String 0) #\Escape)   ; Stick ESCAPE in for the spaces
    (setf (aref String 4) #\Escape)
    (princ String)                    ; PRINC doesn't do a CR (PRINT does)
    (values) ))
    
;;;======================================================================
;;; Again, don't use this from within emacs.

(defun Move-Up (Lines)
  "On a vt100 terminal, move cursor up the specified number of lines"
  (let ((String (format nil "~A[~DA" #\Escape Lines)))  ; ie "ESC[3A"
    (format t String)
    (values)))                                          ; Suppress output

;;;======================================================================

					- Marty
(proclaim '(inline skates))
From: Bruno Haible
Subject: Re: "Clear screen / goto (x,y).. please help
Date: 
Message-ID: <3o5e0p$9e7@info4.rus.uni-stuttgart.de>
> Could some one please tell me the format directives or
> commands to move the cursor to some point in the screen
> or alternatively to clear the screen and go to the top ?

In case you are using CLISP, the following chunk of code will do what
you want:

(use-package "SCREEN")

(with-window
  ...
  (set-window-cursor-position *window* line column) ; "go" to some point
  ...
  (clear-window *window*) ; clear the screen and go to the top
  ...
)

                 Bruno Haible
                 ······@ma2s2.mathematik.uni-karlsruhe.de
From: Mr MP Soysa
Subject: Re: "Clear screen / goto (x,y).. please help
Date: 
Message-ID: <3o95gv$puj@harbinger.cc.monash.edu.au>
Thanks a lot to everyone who replied.

Manjuka