Terminal control/Clear the screen: Difference between revisions

→‎{{header|Common Lisp}}: Add a Lisp example using ncurses
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(→‎{{header|Common Lisp}}: Add a Lisp example using ncurses)
Line 336:
(sh "clear")
</lang>
 
==={{header|ncurses}}===
When the ncurses terminal library is used, characters are displayed on an alternate screen. Clearing that alternate screen does not clear the main screen of the terminal from which ncurses was started. To interface ncurses from Lisp, the ''croatoan'' library is used.
<lang lisp>(defun clear-test ()
;; starting ncurses enters the alternate screen buffer of the terminal
(with-screen (scr :input-echoing nil :input-blocking t)
(princ "Text to be cleared" scr)
(refresh scr)
;; wait for a keypress
(get-char scr)
(clear scr)
(refresh scr)
(get-char scr)))
;; leaving ncurses returns the terminal to the main screen buffer</lang>
 
=={{header|D}}==
69

edits