www.delorie.com/gnu/docs/bash/termcap_30.html   search  
 
Buy the book!


The Termcap Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7 Clearing Parts of the Screen

There are several terminal capabilities for clearing parts of the screen to blank. All display terminals support the `cl' string, and most display terminals support all of these capabilities.

`cl'
String of commands to clear the entire screen and position the cursor at the upper left corner.

`cd'
String of commands to clear the line the cursor is on, and all the lines below it, down to the bottom of the screen. This command string should be used only with the cursor in column zero; their effect is undefined if the cursor is elsewhere.

`ce'
String of commands to clear from the cursor to the end of the current line.

`ec'
String of commands to clear n characters, starting with the character that the cursor is on. This command string is expected to leave the cursor position unchanged. The parameter n should never be large enough to reach past the right margin; the effect of such a large parameter would be undefined.

Clear to end of line (`ce') is extremely important in programs that maintain an updating display. Nearly all display terminals support this operation, so it is acceptable for a an application program to refuse to work if `ce' is not present. However, if you do not want this limitation, you can accomplish clearing to end of line by outputting spaces until you reach the right margin. In order to do this, you must know the current horizontal position. Also, this technique assumes that writing a space will erase. But this happens to be true on all the display terminals that fail to support `ce'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003