previous next top contents index framed top this page unframed
Example 9–1. A Screen with Two Windows
| status line -MAINED--36.3--C---FOO----------------- <- for top window : : :This top window shows part of the : :buffer named "FOO". Editing commands: :are executed in this window. : :The cursor is here: _ : : : status line for -MAINED--2.47------BAR----------------- <- bottom window : : :In the bottom window is text from the: :buffer "BAR". This window is : :currently inactive, since the cursor : :is in the other window. : |
The status line at the top of each window reports the name of the buffer and the page and line number of the top line of the window. In addition, the status line of the window in which the cursor is positioned contains a letter indicating the mode, e.g., C. See Chapter 1 of the MAINEDIT User's Guide for more information on the status line.
The window in which the cursor is positioned is the current window. To move the cursor to a buffer that is not in the current window, use the .B command, described in Chapter 10, or the .Y command, described in Chapter 3.
9.1. Changing Window Size
Window sizes are limited only by the size of your terminal screen.
The ..W, QX, and
QY commands change the width and height of the
current window. See Table 9–2.
Table 9–2. Window Management Commands
| Command | Action |
|---|---|
| n..W | Set right margin for all buffers to n |
| QnX | Set right margin to column n |
| -QnX | Set left margin at column n |
| -Q0X | Set left margin to line origin |
| QnY | Set window height to n rows |
| Q0Y | Kill current window (prompts for new buffer) |
| QY | Make current window as large as possible |
| Q+Y | Expand current window to bottom of screen |
| Q+nY | Expand current window by n rows |
| -QY | Synonym for Q0Y |
| -QnY | Shrink current window by n rows |
In addition to changing the size of a window, the Q+{n}Y, Q-{n}Y, and Q{n}Y commands associate a default size with a window. The window's default size is used whenever it is made visible (unless overridden by the count modifier (n) of the command used to make the window visible).
All forms of the Y command that change a window's size are ignored when in proportionalWindowsMode (except QY, which sets the current window to the maximum size). proportionalWindowsMode is discussed in Chapter 16.
n..W sets the window width for all buffers to n (as if you had done a QnX in each buffer).
The -QnX command provides left-right scrolling of a window. For example, if columns one through 72 are currently visible on the screen, then -Q50X makes columns 50 through 121 visible. An asterisk is displayed instead of a colon on the left margin of each line that contains characters whenever the leftmost column displayed is not column one. See Example 9–3.
Example 9–3. Left-Right Scrolling
| A window that originally looks like this:
-MAINED--4.6---C---XYZ---------------- looks like this after a -Q10X command is issued:
-MAINED--4.6---C---XYZ---------------- |
MAINED commands that manipulate windows, e.g., B, F, Y, etc., use only the unanchored portion of the screen when bringing an unanchored window into view and when changing the size of an unanchored window (MAINED ensures that there are at least two unanchored lines on the screen). In other words, anchoring a window effectively reduces the size of the screen available for unanchored window manipulation.
One or more windows can be anchored at the top of the screen and/or at the bottom of the screen. When a window is anchored at the top of the screen, it is anchored immediately below the bottommost anchored top window (at the top if there are no windows anchored at the top). When a window is anchored at the bottom of the screen, it is anchored immediately above the topmost anchored bottom window (at the bottom if there are no windows anchored at the bottom).
The cursor is moved to an anchored window with normal MAINED commands, e.g., .Y and .B. Once a window is anchored, it remains anchored until it is explicitly unanchored or until it is killed. An anchored window is independent of the buffer in it. Even when the buffer in an anchored window is changed, e.g., with the .B or .F commands, the window remains anchored. However, if the buffer in a window is killed, the window is also killed, and hence, unanchored.
Table 9–4 shows the commands used to anchor and unanchor windows.
Table 9–4. Commands Used to Anchor and Unanchor Windows
| Command | Action |
|---|---|
| .A | anchor current window |
| +.A | anchor at bottom |
| -.A | anchor at top |
| n.A | anchor, change size to n rows |
| +n.A | anchor at bottom, change size to n rows |
| -n.A | anchor at top, change size to n rows |
| ..A | unanchor current window |
| Q..A | unanchor all windows |
| Q+..A | unanchor all windows at bottom of screen |
| Q-..A | unanchor all windows at top of screen |
The .A command anchors the current window. If no modifiers are specified and the window is immediately above the topmost anchored bottom window (or at the bottom of the screen if there are no windows anchored at the bottom), then it is anchored at the bottom. Otherwise, it is anchored at the top. If the minus modifier (-) is specified, the window is anchored at the top of the screen. If the plus modifier (+) is specified, the window is anchored at the bottom of the screen.
The anchored window is adjusted to be n rows (its size remains unchanged if n is not specified). Any number of windows can be anchored, as long as there are at least two unanchored lines on the screen.
The ..A command unanchors the current window. If the window is anchored at the top of the screen and there are other windows below it that are also anchored at the top, then the window is repositioned immediately below the bottommost anchored top window. Similarly, if the window is anchored at the bottom of the screen and there are other windows above it that are also anchored at the bottom of the screen, the window is repositioned immediately above the topmost anchored bottom window. The emphasis modifier (Q) means unanchor all windows; Q- means unanchor all windows anchored at the top of the screen; Q+ means unanchor all windows anchored at the bottom of the screen.