|Version 3 (modified by gz, 6 years ago) (diff)|
10. Controlling the Display
A hemlock-view represents the GUI object(s) used to display the contents of a buffer. Conceptually it consists of a text buffer, a modeline for semi-permanent status info, an echo area for transient status info, and a text input area for reading prompted input. (Currently the last two are conflated, i.e. text input happens in the echo area).
The API for working with hemlock-views is not fully defined yet. If you need to work with views beyond what's listed here, you will probably need to get in the sources and find some internal functions to call.
10.2. The Current View
current-view returns the hemlock view which is the target of the currently executing command. This is usually the frontmost hemlock window in the current application.
10.3. View Functions
hemlock-view-p object [Function]
This function returns t if object is a hemlock view, otherwise nil.
hemlock-view-buffer view [Function]
This function returns the buffer which is displayed in the view.
10.4. Cursor Positions
mark-column mark [Function]
This function returns the X position at which mark would be displayed, supposing its line was displayed on an infinitely wide screen. This takes into consideration strange characters such as tabs.
move-to-column mark column &optional line [Function]
This function is analogous to move-to-position (page 5), except that it moves mark to the position on line which corresponds to the specified column. If the line would not reach to the specified column, then nil is returned and mark is not modified. Note that since a character may be displayed on more than one column on the screen, several different values of column may cause mark to be moved to the same position.
The display of the buffer contents on the screen is updated at the end of each command. The following function can be used to control the scroll position of the buffer in the view.
set-scroll-position how &optional what [Function]
Normally, after a command that changes the contents of the buffer or the selection (i.e. the active region), the event handler repositions the view so that the selection is visible, scrolling the buffer as necessary. Calling this function tells the system to not do that, and instead to position the buffer in a particular way. how can be one of the following:
- This causes the selection (or the point) to be centered in the visible area. what is ignored.
- This causes the previous page of the buffer to be shown what is ignored.
- This causes the next page of the buffer to be shown. what is ignored.
- This causes what previous lines to be scrolled in at the top. what must be an integer.
- This causes what next lines to be scrolled in at the bottom. what must be an integer.
- This causes the line containing what to be scrolled to the top of the view. what must be a mark.