Keyboard commands

The text cursor, or just cursor for short, can be moved around the screen with the arrow keys. As long as the cursor doesn't traverse any of the screen boundaries within which text can appear, the moving of the cursor is rather straightforward. If the cursor is at the edge of the screen on any side, and the move induced by the arrow key results in a move of the cursor to a position currently not displayed on the screen, a scroll will be induced. This means that stedi will re-adjust its screen representation to show a different part of the file.

For vertical scrolling, the screen scrolls only one line up or down, giving the impression of motion through a file. This vertical scrolling can be continued until either the first line of the file has been reached, or the fifth virtual line after the last line of the file is displayed. The horizontal scroll moves the screen (actually it moves the screen representation of course) by a number of columns to the left or to the right. This means that the screen shows a range of columns which for instance can be columns 1 to 80, 21 to 100, 41 to 120, etc. Once the display moves to a certain range of columns this range will be kept until a user command forces stedi to move to a different range. The number of columns that will be scrolled when a scroll is needed can be set with a command line command. The command

    set hstep = number
given from the command line (see p. [*] and later in this chapter) in which number is less than or equal to the number of characters that can be displayed in a single line, sets this stepsize.

The arrow keys, in conjunction with the Shift keys , can be used to move through a file in larger steps. Shift-up-arrow and Shift-down-arrow, also called Shift-up and Shift-down, scroll the screen by its number of lines minus 4 if the screen has at least 20 lines. For windows that aren't that high the 4 is correspondingly less. This action can be taken independently of which position the cursor occupies on the screen. Similarly Ctrl-left-arrow and Ctrl-right-arrow can induce a horizontal scroll independent of the cursor position. On computers with a PageUp and a PageDown key these keys take on their natural meaning and replace therefore the Shift-up-arrow and Shift-down-arrow combinations. These combinations may remain active though.

The lack of uniformity between the commands for horizontal and vertical motion has to do with the fact that another type of horizontal scrolling is used more frequently. Shift-left and Shift-right are assigned to these commands. The more often used commands which induce large horizontal movements of the cursor cause the cursor to go to either the beginning or the end of the current line. The end is defined as the position just after the last character in a line. Thus Shift-left moves the cursor to the beginning of the current line and Shift-right moves the cursor to the end. Either command may cause horizontal scrolls when necessary.

There are some extra cursor operations that are performed with the arrow keys. Ctrl-up or shift-PageUp scrolls the screen down by one line while leaving the cursor in a fixed position. This has the effect of scrolling the cursor up one line relative to the screen and is similar to what happens when the cursor is at the top of the screen and the up-arrow key is pressed. Similarly Ctrl-down or shift-PageDn induces a scrolling of the screen up by one line while the cursor remains fixed. These operations can be very useful at times.

Ctrl-Shift-left and Ctrl-Shift-right move the cursor in a text bound fashion. They move the cursor from character to character, treating a tab mark with its induced spaces as a single character and moving to the previous or the next line when there are no more characters in the current line. Some people prefer this way of moving the cursor. If one would like to change the keyboard such that this cursor movement is the one connected to the normal arrow keys, one should consult the chapter on key redefinitions.

Finally there are some special positions in a file which need to be moved to rather frequently. These are the beginning of the file and the end of the file. When the Home key is pressed, the cursor moves to the beginning of the file. This key can also be used if for some reason the screen display becomes distorted or the line numbers are miscounting. In that role it is a kind of clear or editor reset key that re-evaluates the layout of the file being edited. The end of the file can be reached with the End key if there is one and otherwise with Shift-Home. This places the cursor after the last character in the file. For moving the cursor to the first position on the current screen (top line leftmost corner), one may use Ctrl-Home while Ctrl-Shift-Home will move the cursor to the left most position in the bottom line of the current screen. On computers with an `End' key these codes are shift-Home and shift-End respectively.