kristofer sweger Home
ANSIPLUS Home


Scrolling

Esc [#;#;#;#;#S  Scroll up
Esc [!#;#;#;#;#S  Scroll up and add to scroll-back
Esc [#;#;#;#;#T  Scroll down
Esc [!#;#;#;#;#T  Scroll down from scroll-back
Esc [#;#;#;#;# Space @  Scroll left
Esc [#;#;#;#;# Space A  Scroll right

The screen is scrolled up, down,left or right with the Esc [S, Esc [T, Esc [ @ and Esc [ A control sequences, respectively, which are all standard ANSI terminal functions that are not included in the ANSI.sys driver. (Note that Esc [ @ and Esc [ A both require a blank space before the command letter.) The Esc [!S and Esc [!T escape sequences are ANSIPLUS-only variants that add the lines scrolled from screen to scroll-back ( Esc [!S ), or remove the most recent lines from scroll-back and insert them at the top of the scrolled region ( Esc [!T ).

All six scrolling functions accept up to five parameters, any number of which can be omitted. The five parameters and their default values (in parentheses) are:

  1. Distance in lines or characters to move the data (1);
  2. Minimum line number to scroll (1);
  3. Maximum line to scroll (maximum line on the screen);
  4. Minimum column number to scroll (1); and
  5. Maximum column to scroll (maximum column on the screen).

Examples:

Esc [S Scroll the entire screen up one line
Esc [2T Scroll the entire screen down two lines
Esc [!3T Scroll the entire screen down three lines, inserting the latest three lines from scroll-back at the top
Esc [1;6;20;11;70 A Scroll lines 6-20 in columns 11-70 right by 3 characters

Esc [#;#;#;#r Set scrolling region

The Esc [r control sequence defines a sub-screen region (or "window") for subsequent scrolling or other DOS, ANSI, or Int 10h video BIOS output. This function accepts up to four parameters, any number of which can be omitted. The parameters and their default values (in parentheses) are:

  1. Minimum line in the scrolling region (1);
  2. Maximum line in the scrolling region (maximum line on the screen);
  3. Minimum column in the scrolling region (1); and
  4. Maximum column in the scrolling region (maximum column on the screen).

When a sub-screen scrolling region is in effect, programs that use DOS calls, ANSIPLUS escape sequences, or standard Int 10h BIOS calls for screen output in either text or graphics modes are "fooled" into believing they are using a screen which has a size equal to the size of the scrolling region, rather than the full screen. All output to this "virtual" screen is automatically redirected by ANSIPLUS to the screen window rather than to the top left corner of the actual screen. DOS output also automatically wraps around to the left margin of the region when it reaches the right margin, and lines that scroll off the top are automatically captured for scroll-back (if capture from sub-screen scrolling regions is enabled). In fact, it is even possible to run a reasonably well behaved command shell, such as COMMAND.com, in a sub-screen scrolling region. The scrolling region remains in effect until either a new scrolling region is defined by Esc [r, or a new display mode is selected.

Scrolling regions are intended as a simple aid for writing, adapting or improving applications, and not as a means to make entire applications run within windows. That is what more comprehensive systems, such as Windows, OS/2 or DESQview are for. Because of this limited goal, the mouse is not restricted to the sub-screen window, and coordinates returned by mouse movement or button clicks will always refer to the actual screen, not the virtual screen. Nor is any effort made to detect or control applications that use direct access to screen memory or set the hardware cursor directly.

Examples:

Esc [r Reset the scrolling region to the full screen
Esc [4;24r Define a scrolling region that covers screen lines 4 to 24
Esc [6;20;11;70r Define a region bounded by lines 6-20 and columns 11-70

© Copyright 2000-2007, Kristofer Sweger. All rights reserved.
Rev. 10/16/07