Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from rec.arts.ascii, 4 Nov 1994.
Info: Control codes

Info: Control codes

Here are some that are fairly universal in my experience (no
guarantees, mind you :-)  

Escape Sequence Functions (ESC represents the escape character - ascii 27)

     ESC[#@      Insert Character (ICH)
          Takes one parameter, # (default 1).  Inserts  #  spaces
          at  the  current  cursor  position.   The  tail  of the
          current line starting at the  current  cursor  position
          inclusive  is shifted to the right by # character posi-
          tions to make room for the  spaces.   The  rightmost  #
          character  positions  shift  off the line and are lost.
          The position of the cursor is unchanged.

     ESC[#A      Cursor Up (CUU)
          Takes one parameter, # (default 1).  Moves  the  cursor
          up  #  lines.  If the cursor is fewer than # lines from
          the top of the screen, moves the cursor to the  topmost
          line on the screen.  The character position of the cur-
          sor on the line is unchanged.

     ESC[#B      Cursor Down (CUD)
          Takes one parameter, # (default 1).  Moves  the  cursor
          down # lines.  If the cursor is fewer than # lines from
          the bottom of the screen, move the cursor to  the  last
          line on the screen.  The character position of the cur-
          sor on the line is unchanged.

     ESC[#C      Cursor Forward (CUF)
          Takes one parameter, # (default 1).  Moves  the  cursor
          to  the  right  by # character positions on the current
          line.  If the cursor is fewer than # positions from the
          right  edge  of  the  screen,  moves  the cursor to the
          rightmost position on the current line.

     ESC[#D      Cursor Backward (CUB)
          Takes one parameter, # (default 1).  Moves  the  cursor
          to  the  left  by  # character positions on the current
          line.  If the cursor is fewer than # positions from the
          left  edge of the screen, moves the cursor to the left-
          most position on the current line.

     ESC[#E      Cursor Next Line (CNL)
          Takes one parameter, # (default 1).  Positions the cur-
          sor at the leftmost character position on the #-th line
          below the current line.  If the current  line  is  less
          than  #  lines from the bottom of the screen, positions
          the cursor at the leftmost character  position  on  the
          bottom line.

     ESC[#1;#2f  Horizontal And Vertical Position (HVP)
          or
     ESC[#1;#2H  Cursor Position (CUP)
          Takes two parameters, #1 and #2 (default 1, 1).   Moves
          the cursor to the #2-th character position on the #1-th
          line.  Character positions are numbered from 1  at  the
          left  edge  of  the screen; line positions are numbered
          from 1 at the top of the screen.  Hence, if both param-
          eters  are omitted, the default action moves the cursor
          to the home position (upper left corner).  If only  one
          parameter  is supplied, the cursor moves to column 1 of
          the specified line.

     ESC[J       Erase in Display (ED)
          Takes no parameters.  Erases from  the  current  cursor
          position  inclusive to the end of the screen.  In other
          words,  erases  from  the   current   cursor   position
          inclusive  to the end of the current line and all lines
          below  the  current  line.   The  cursor  position   is
          unchanged.

     ESC[K       Erase in Line (EL)
          Takes no parameters.  Erases from  the  current  cursor
          position inclusive to the end of the current line.  The
          cursor position is unchanged.

     ESC[#L      Insert Line (IL)
          Takes one parameter, # (default 1).  Makes room  for  #
          new  lines  starting  at  the current line by scrolling
          down by # lines the portion  of  the  screen  from  the
          current  line inclusive to the bottom.  The # new lines
          at the cursor are filled  with  spaces;  the  bottom  #
          lines  shift off the bottom of the screen and are lost.
          The position of the cursor on the screen is unchanged.

     ESC[#M      Delete Line (DL)
          Takes one parameter, # (default 1).   Deletes  #  lines
          beginning  with  the  current line.  The portion of the
          screen from the current line inclusive to the bottom is
          scrolled  upward by # lines.  The # new lines scrolling
          onto the bottom of the screen are filled  with  spaces;
          the  #  old  lines  beginning  at  the  cursor line are
          deleted.  The position of the cursor on the  screen  is
          unchanged.

     ESC[#P      Delete Character (DCH)
          Takes one parameter, # (default 1).  Deletes #  charac-
          ters starting with the current cursor position.  Shifts
          to the left by # character positions the  tail  of  the
          current line from the current cursor position inclusive
          to the end of the line.  Blanks are  shifted  into  the
          rightmost  #  character positions.  The position of the
          cursor on the screen is unchanged.

     ESC[#m      Select Graphic Rendition (SGR)
          Takes one parameter, # (default 0).  Note: unlike  most
          escape  sequences,  the  parameter  defaults to zero if
          omitted.  Invokes the graphic  rendition  specified  by
          the  parameter.   All  following printing characters in
          the data stream are rendered according to the parameter
          until  the  next  occurrence of this escape sequence in
          the data stream.

	  (It seems to me that # can be one of 8 values - 0 thru
	  7 - but I don't remember what the values mean except
	  that 0 takes you back to "normal" - i.e., no special
	  display characteristics.)

On some machines, only a subset of these are supported. Also, on some
machines some of these sequences cause antisocial behavior (log off,
hung screen, digibarf, etc), so watch out for potholes.

regards,

doc

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fbb9d,e371731b1303cf48,start
X-Google-Attributes: gidfbb9d,public
X-Google-ArrivalTime: 1994-11-04 10:26:38 PST
Path: nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!news.sprintlink.net!sashimi.wwa.com!not-for-mail
From: Ric...@ebay.sun.com (Richard "Doc" Ahrens)
Newsgroups: rec.arts.ascii
Subject: Info: Control codes
Date: 4 Nov 1994 12:26:38 -0600
Organization: Sun Microsystems Inc.
Lines: 129
Sender: bob...@wwa.com
Approved: bob...@wwa.com
Message-ID: <39ducu$qh...@gagme.wwa.com>
References: <39c1pp$q4...@gagme.wwa.com>
Reply-To: Ric...@ebay.sun.com
NNTP-Posting-Host: gagme.wwa.com
About this message. This message was posted publicly to the newsgroup rec.arts.ascii in 1994 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post