The following diagram shows startup with two files loaded (buffers b2 and b3) and two windows (w1 and w2) viewing those files:

The extra window, w0, is a hidden window used to allow quick switching to system buffers such as .command and .killed. If you attempt to leave the hidden window active, another window is made active when the editor refreshes the screen. Since window w1 is active, you currently see window w1 of buffer b2. You might be able to see window w2 of buffer b3 if the window w1 does not overlap window w2.
A ring of buffers and a ring of windows are maintained, where each window may contain a ring of views. However, by convention, all windows except the hidden window contain one view. Some macros temporarily create extra views in other windows, but they delete them before they terminate.
The tables in the following sections show some of the buffer and windowing built-ins that are available.
The built-ins _next_buffer and _prev_buffer activate the next and previous buffers. _next_window and _prev_window move around the window ring. _next_view and _prev_view move around the active view ring. The built-in function load_files inserts views, windows, and/or buffers. The command _delete_buffer removes the active buffer from the buffer ring and activates the previous non-hidden buffer. _quit_view removes the active view from the active windows view ring. The previous view becomes the new active view. When _quit_view is executed and only one view exists in the active window, the window is removed and the previous window becomes active. The hidden window cannot be deleted.
A view holds the information necessary for the editor to remember the location and scroll position in a buffer. A view also contains a window id and a buffer id. Activating a view with the activate_view built-in activates the window and buffer specified by the view as well as selecting the cursor location/scroll position.
Each buffer maintains a non-active view. When a buffer is activated by one of the built-ins _next_buffer, _prev_buffer, _delete_buffer or load_files (assuming you do not use an option that overrides this), the active view information is saved in the non-active view of the buffer, and the buffer's new non-active view information is copied into the active view.
The following sections describe the contents of each structure.
|
Window Property |
Description |
|---|---|
|
p_window_x, p_window_y |
Top left coordinates of window. |
|
p_tile_id |
Indicates that windows are part of a tile window group and whether a window is zoomed. Windows of a tiled window group have the same tile_id. A zoomed window has a negative tile_id. |
|
p_x |
The top left x position of window. |
|
p_y |
The top left y position of window. |
|
p_height |
Window height. |
|
p_width |
Window width. |
|
p_view_id |
Pointer to active view. |
|
p_next (_next_window) |
Window id of next window. |
|
p_prev (_prev_window) |
Window id of previous window. |
|
p_child |
Window id of child window. |
|
View Property |
Description |
|---|---|
|
block,line within block |
Accessible via point and goto_point. |
|
p_line |
Line number of current line. |
|
p_col |
Column position within current line (1..2 billion). |
|
p_left_edge |
Column scroll position. |
|
p_cursor_x |
Text cursor x position. |
|
p_cursor_y |
Text cursor y position. |
|
p_window_id |
Window id. |
|
p_buf_id |
Buffer id. |
|
Buffer Property |
Description |
|---|---|
|
p_buf_name |
Name of buffer. |
|
p_buf_flags |
Indicates whether a buffer is hidden and may specify other buffer options. |
|
p_Noflines |
Number of lines in file. |
|
p_modify |
Non-zero indicates buffer has been modified. |
|
p_margins |
String containing left, right, and new paragraph margins (1..2 billion). |
|
p_tabs |
String containing up to 2 billion tab stops. |
|
p_mode_name |
Name of current mode. |