| Screen Primitives | |
| Macros | |
| borders | Set window border status. |
| color | Set the basic colors. |
| copy_screen | Copy the current screen. |
| cursor | Control cursor display. |
| display_mode | Set/retrieve display control flags. |
| display_windows | Control window display. |
| echo_line | Set echo line flags. |
| ega | Terminal line display. |
| get_color | Retrieve screen colors. |
| inq_borders | Retrieve the border status. |
| inq_cmd_line | Retrieve the command line message. |
| inq_color | Retrieve the basic colors. |
| inq_command | Retrieve name of last keyboard command. |
| inq_display_mode | Inquire display control flags. |
| inq_echo_format | Retrieve the echo-line format. |
| inq_echo_line | Retrieve the echo-line flags. |
| inq_font | Inquire the current window fonts. |
| inq_line_col | Retrieve the echo_line content. |
| inq_message | Retrieve the prompt line. |
| inq_prompt | Retrieve the prompt status. |
| inq_screen_size | Determine screen dimensions. |
| inq_window_color | Retrieve the window attribute. |
| inq_window_priority | Retrieve the windows display priority. |
| inq_window_size | Retrieve the window size. |
| redraw | Redraw screen. |
| refresh | Update the display. |
| screen_dump | Dump an image of the screen. |
| set_color | Set screen colors. |
| set_echo_format | Set the echo line format. |
| set_window_priority | Set the window display priority. |
| use_tab_char | Configure use of hard/soft tabs. |
| view_screen | View the content of underlying screen. |
| window_color | Set the window attribute. |
int borders( [int borders] )
Set window border status.
The borders() primitive either sets or toggles the tiled window border status.
Disabling borders can improve display performance on slow systems, yet shall disable scroll bars, title bars and may make working with multiple windows difficult.
| borders | An optional integer stated on (1) or off (0). If omitted, the current value is toggled. A value of -1, acts the same as inq_borders() only returning the current status without effecting any change. |
An integer boolean value representing the previous border state.
n/a
int color( [int background], [int normal], [int selected], [int message], [int error], [int hilite], [int hilite_fg], ... )
Set the basic colors.
The color() primitive configures the standard color attributes. color is only intended for use with the basic color set and is provided only for backward compatibility.
If background is omitted, all colors shall be prompted. Colors are numeric values in the range 0..15 or their symbolic name as follows:
| Value |
Name |
Value |
Name |
|---|---|---|---|
| 0 |
Black |
8 |
Dark-grey |
| 1 |
Blue |
9 |
Bright-blue |
| 2 |
Green |
10 |
Bright-green |
| 3 |
Cyan |
11 |
Bright-cyan |
| 4 |
Red |
12 |
Bright-red |
| 5 |
Magenta |
13 |
Bright-magent |
| 6 |
Brown |
14 |
Yellow |
| 7 |
White |
15 |
bright-white |
Additional colors maybe modified, yet would advice only the use of symbolic color names and not color values to avoid issues when dealing with terminals which support greater then 16 colors.
The alternative interfaces of set_color and set_color_pair are the preferred interfaces for new macros.
| background | The background color. |
| normal | The normal text color. |
| selected | Highlighting color for the selected window title. |
| message | The color for normal messages. |
| error | The color for error messages. |
| hilite | Color of marked areas. The value either states both the foreground and background of the marked areas as high nibble is background and the low is foreground. Unless hilite_fg is stated in which case only the foreground. |
| hilite_fg | Foreground color of marked areas. |
The color() primitive returns 1 on success, otherwise 0 if one or more of the colors is invalid.
Set the background color to blue and the foreground color to white, and active window title to bright cyan.
color(1, 7, 11);
Colors definitions beyond frame are system dependent.
void copy_screen()
Copy the current screen.
The copy_screen() primitive exports an image of the current editor windows to the current buffer.
none
nothing
A GriefEdit extension; this primitive is subject for removal, and has been removed from recent CrispEdit™ releases.
int cursor( int state )
Control cursor display.
The cursor() primitive controls whether the cursor is visible, by default the cursor is enabled.
The cursor visibility is set to state with a non-zero value enabling and a zero value disabling, if omitted then the current value is toggled.
| state | Optional boolean cursor status, if omitted the current status is toggled. |
The cursor() primitive returns 0 on success, otherwise non-zero.
A GriefEdit extension.
int display_mode( [int or_mask|string set-list], [int and_mask|string clear-list], [int scroll_cols], [int scroll_rows], [int visible_cols], [int visible_rows], [int number_cols] )
Set/retrieve display control flags.
The display_mode() primitive controls primary features of the display interface. Features are either stated using their manifest constant or in the case of values an explicit parameters
If specified one or more flags shall be cleared using the and_mask, in additional one or more flags are set using the or_mask.
| Constant |
Name |
Description |
|---|---|---|
| DC_WINDOW |
window |
Running under a windowing system (ro). |
| DC_MOUSE |
mouse |
Mouse enabled/available (ro). |
| DC_READONLY |
readonly |
Read-only mode (ro). |
| DC_CHARMODE |
charmode |
Character-mode with basic GUI features (r |
| DC_SHADOW |
shadow |
Display shadow around popups. |
| DC_SHADOW_SHOWTHRU |
showthru |
Show-thru shadow around popups. |
| DC_STATUSLINE |
statusline |
Status line. |
| DC_UNICODE |
unicode |
UNICODE character encoding available (ro) |
| DC_ASCIIONLY |
asciionly |
ASCII only characters witihin UI/dialogs. |
| DC_ROSUFFIX |
rosuffix |
Read-only suffix on titles. |
| DC_MODSUFFIX |
modsuffix |
Modified suffix. |
| DC_EOF_DISPLAY |
eof_display |
Show <EOF> marker. |
| DC_TILDE_DISPLAY |
tilde_display |
Show ~ marker. |
| DC_EOL_HILITE |
eol_hilite |
Limit hilites to EOL. |
| DC_HIMODIFIED |
himodified |
Hilite modified lines. |
| DC_HIADDITIONAL |
hiadditional |
Hilite additional lines. |
Items marked as (ro) are Read-Only with any specified changes against the attribute shall be quietly ignored.
The optional parameters scroll_cols and scroll_rows define the screen distance each scroll operation shall employ. Values greater than one result in scroll jumps, which may be desired on slower terminals.
The optional parameters visual_cols and visual_rows define the smallest display arena which shall be permitted, with number_cols defining the number line arena width.
| set_mask | Optional mask of flags to set. May either be an integer of AND’ed together flag constants, or alternatively a string of comma separated flag names. |
| clear_mask | Optional mask of flags to clear. May either be an integer of AND’ed together flag constants, or alternatively a string of comma separated flag names. |
| scroll_cols | Optional integer value, if stated sets the number of screen columns scroll operations shall employ. A value of zero shall clear the scroll override, defaulting the value to 1. Upon a negative value, the current override shall be returned. |
| scroll_rows | Optional integer value, if stated sets the number of screen rows scroll operations shall employ. A value of zero shall clear the scroll override, defaulting the value to 1. Upon a negative value, the current override shall be returned. |
| visible_cols | Optional integer value, if stated sets the lower bounds of the display arena width. Upon a negative value, the current override shall be returned. |
| visible_rows | Optional integer value, if stated sets the lower bounds of the display arena height. Upon a negative value, the current override shall be returned. |
| number_cols | Optional integer value, if stated as a positive integer sets the width of the number-line column within windows, disabling dynamic width selection. A value of zero shall clear the width override, enabling the default dynamic width based upon the buffer length. Upon a negative value, the current override shall be returned. |
The display_mode() primitive by default returns the previous value of the display control flags prior to any modifications.
If one of the integer parameters is a negative value (e.g. -1) then display_mode returns the current value of the associated parameter. If more than one is negative, then the value of last shall be returned.
The string mask variants and set parameter are GRIEF extensions.
Many of the flags are GRIEF specific; CRiSP ™ has a similar primitive yet as the two were developed independently features differ.
int display_windows( [int mode] )
Control window display.
The display_window() primitive control the state of the display driver.
This primitive should be called prior to the creation of any windows using create_tiled_window enabling the display driver. If any tiled windows exist when enabled the following error shall be echoed, denoting incorrect system initialisation.
display_window: overlapping window exist
The original functionality was intended to initialise a set of tiled windows, between two successive calls; firstly with disable (0) which cleared all windows and secondary on the completion of the window creation with enable (1). This implementation only obeys the first enable command, with any disable requests silently ignored.
| mode | Optional integer, if specified states the new display mode, otherwise if omitted the current display mode is toggled. |
The display_window() primitive returns the previous status.
Unlike BRIEF existing tiled windows are not destroyed upon the initial mode change.
int echo_line( [int flags] )
Set echo line flags.
The echo_line() primitive controls the fields which are to be visible within the status area.
The status area layout can be defined by one of two means. The echo_line specification controls the elements visible using a fixed layout whereas set_echo_format allows a user defined format specification.
The default echo_line configuration is.
E_CHARVALUE | E_VIRTUAL | E_LINE | E_COL | \
E_CURSOR | E_REMEMBER | E_TIME
| flags | Optional integer flags, one or more of the following flags OR’ed together control the components to be reported against each attribute. If omitted then only the current flag values are returned without any change. |
| Constant |
Order |
Definition |
|---|---|---|
| E_CHARVALUE |
1 |
Character value. |
| E_VIRTUAL |
2 |
Virtual character indicator. |
| E_LINE |
3 |
Line: field. |
| E_COL |
4 |
Col: field. |
| E_PERCENT |
5 |
nn% |
| E_CURSOR |
7 |
Insert/overstrike status (OV or blank). |
| E_REMEMBER |
6 |
Remember status (RE and PA). |
| E_TIME |
8 |
HH:MM a/pm |
| E_TIME24 |
8 |
Time in 24hour form (HH:MM). |
| E_FORMAT |
n/a |
Format override active. |
| E_FROZEN |
n/a |
Echo line is frozen, ie not updated. |
When an status area user specified format is active then the E_FORMAT flag is enabled (See: set_echo_format). Setting a format also sets E_FORMAT similarly clearing the format clears E_FORMAT.
The E_FROZEN flag disables status area updates whilst set. E_FROZEN can be utilised by macros to reduce screen updates during buffer operations.
The E_CHARVALUE element identifies the character under the cursor. Normal printable characters are enclosed within a set of square brackets, with non-printable characters represented by their hexadecimal value. When the cursor is positioned past the end of the current line, EOL is displayed, and when past the end of file, EOF is displayed.
The E_VIRTUAL element indicates whether the current character is either a physical or virtual character in the case of tabs, EOL and EOF conditions.
The virtual character status is represented by one of the following otherwise blank if a normal character.
| X | Virtual space, for example logical space created as the result of tab expansion. |
| $ | End of line. |
| + | Position is past the end-of-line. |
| # | Is a Unicode encoded character. |
| ! | Is an illegal Unicode character code. |
The E_LINE and E_COL elements represents the line (row) and column where the cursor is located. Unless invoked with restore enabled, when GRIEF is started the cursor is located at top of the current buffer, being line one(1) and column one(1).
The E_CURSOR element represents the optional cursor mode.
On systems which have means of controlling the cursor, the current insert/overstrike mode is represented by the cursor shape; when overstrike mode a large/block cursor is used wheras insert mode shall utilise a small/underline cursor.
Otherwise on systems without cursor control a mode indicator shall be displayed, OV when overstrike is active otherwise blank when in insert mode.
The E_REMEMBER element represents the remember status.
When macro recording is active or paused, RE and PA respectively are displayed.
Last item in the status area is the time, which is displayed in hours and minutes, with a colon as a separator either using a 12-hour format E_TIME or a 24-hour format E_TIME24.
The echo_line() primitive returns the previous flags value.
n/a
int ega( int lines )
Terminal line display.
The ega() primitive attempts to configure the console size to the specified number of lines with an implied width of 80 columns on supporting terminals.
Possible screen dimensions include.
| lines | Optional integer specifing the required number of console lines. Under WIN32 if -1 the console size shall toggled bewteen minimized and maximised. If omitted, then only the current state is returned. |
When running within a windows console, before Windows 7 one could press <Alt+Enter> to run the application in full screen. As of Windows 7 this functionality is no longer available resulting in the following.
This system does not support full screen mode
The ega() primitive can be used to emulate this functionality, using the special -1 flag, which shall toggle between a minimized or maximised sized console.
ega(-1)
The ega() primitive returns the previous status, otherwise -1 upon an error.
A GriefEdit extension.
list get_color( [int flags = 0] )
Retrieve screen colors.
The get_color() primitive retrieves the current display color scheme as a list of strings, each string containing the specification of an individual color attribute.
The reported specifications following the form based upon the optional flags.
[<id>,][<flags>,][<name>=]<spec>
| id | Numeric identifier of the attribute. |
| flags | Control flags. |
| name | Attribute name. |
| spec | Color specification. |
Each color specification followings the following form.
attribute=
sticky@<attribute>|none
| link@<attribute>|none
| <foreground-color>[,<background-color>][|font][:style ...]
| clear
Where colors take one the following forms, see set_color for a list of the reported attributes.
color-name|none
foreground|fg|background|bg|dynamic_fg|dyanmic_bg
decimal (xx), octal (0xxx) or hex (0x###)
#RRGGBB
color[#]ddd
style specifications are in the form :<style> [,<style> ...]
bold
inverse
underline
blink
italic
reverse
standout
dim
undercurl
| flags | Optional integer flags, one or more of the following flags OR’ed together control the components to be reported against each attribute. |
| Constant |
Definition |
|---|---|
| COLORGET_FVALUE |
Attribute numeric value/identifier. |
| COLORGET_FFLAGS |
Type flags. |
| COLORGET_FNAME |
Name. |
Returns a list of colors associated with the color attributes.
If flags was specified then the color attribute flags are returned in a list, instead of the color names.
Example list content using COLORGET_FNAME
"background=none"
"normal=none"
"select=light-cyan"
"message=light-green"
"error=light-red"
"hilite=red"
"hilite_fg=light-white"
"frame=white"
"inscursor=black"
"ovcursor=black"
"shadow=clear"
"prompt=light-magenta,dynamic-bg:link@message"
"question=clear:link@message"
"echo_line=yellow,dynamic-bg"
"statuscolumn=clear:link@message"
"linenocolumn=clear:link@message"
"nonbuffer=brown,dynamic-bg:link@message"
:
:
A GriefEdit extension.
int inq_borders()
Retrieve the border status.
The inq_borders() primitive retrieves the border status which controls whether or not tiled windows are displayed with borders.
Disabling borders can improve display performance on slow systems, yet shall disable scroll bars, title bars and may make working with multiple windows difficult.
none
Returns non-zero if windows borders are enabled, otherwise zero if disabled.
n/a
string inq_color( [int &background], [int &normal], [int &selected], [int &messages], [int &errors], [int &hilite], [int &hilite_fg] )
Retrieve the basic colors.
The inq_color() primitive retrieves color details of the primary color attributes. inq_color is only intended for use with the basic color set and is provided only for backward compatibility.
The alternative interfaces of get_color, set_color, set_color_pair and get_color_pair are the preferred interfaces for new macros.
| background | Background color. |
| normal | Normal text color. |
| selected | Highlighting color for the selected window title. |
| message | Normal messages. |
| error | Error messages. |
| hilite | Color of marked areas. The value either states both the foreground and background of the marked areas as high nibble is background and the low is foreground. Unless hilite_fg is stated in which case only the foreground. |
| hilite_fg | Foreground color of marked areas. |
| frame | Window frame. |
The inq_color() primitive returns a string containing the current color specification, being a space seperated list of color names
n/a
string inq_command()
Retrieve name of last keyboard command.
The inq_command() primitive retrieves the name of last command invoked from keyboard.
Commands with names beginning with an underscore (_) are ignored.
none
The inq_command() primitive returns a string containing the name of the last macro called by the user.
n/a
int inq_display_mode( [string flagname], [string ~flags] )
Inquire display control flags.
The inq_display_mode() primitive retrieves the value of the associated display attribute, given by the parameter flagname.
| Name |
Constant |
Description |
|---|---|---|
| window |
DC_WINDOW |
Running under a windowing system (ro). |
| mouse |
DC_MOUSE |
Mouse enabled/available (ro). |
| readonly |
DC_READONLY |
Read-only mode (ro). |
| charmode |
DC_CHARMODE |
Character-mode with basic GUI features (ro |
| shadow |
DC_SHADOW |
Display shadow around popups. |
| showthru |
DC_SHADOW_SHOWTHRU |
Show-thru shadow around popups. |
| statusline |
DC_STATUSLINE |
Status line. |
| unicode |
DC_UNICODE |
UNICODE character encoding available (ro). |
| asciionly |
DC_ASCIIONLY |
ASCII only characters witihin UI/dialogs. |
| rosuffix |
DC_ROSUFFIX |
Read-only suffix on titles. |
| modsuffix |
DC_MODSUFFIX |
Modified suffix. |
| eof_display |
DC_EOF_DISPLAY |
Show <EOF> marker. |
| tilde_display |
DC_TILDE_DISPLAY |
Show ~ marker. |
| eol_hilite |
DC_EOL_HILITE |
Limit hilites to EOL. |
| himodified |
DC_HIMODIFIED |
Hilite modified lines. |
| hiadditional |
DC_HIADDITIONAL |
Hilite additional lines. |
| scroll_cols |
n/a |
Scroll jump column override. |
| scroll_rows |
n/a |
Scroll Jump row override. |
| visible_cols |
n/a |
Visible display window width lower bounds. |
| visible_rows |
n/a |
Display window height lower bounds. |
| number_cols |
n/a |
Line number column width override. |
| flagname | Optional string parameter, if stated gives the name of the attribute to be retrieved (See: display_mode). If omitted the display mode are retrieved. |
| flags | Optional string parameter, if stated shall be populated with a comma separated list of active attribute names. |
The inq_display_mode() primitive returns the value of the associated attribute, otherwise -1 on error.
GriefEdit extended.
For system portability use of the manifest constants is advised.
int inq_echo_format()
Retrieve the echo-line format.
The inq_echo_format() primitive retrieves the current echo-line format specification.
none
The inq_echo_format returns the current echo line format specification string, otherwise an empty string.
A GriefEdit extension.
int inq_font( string & normalfont, [string &italicfont] )
Inquire the current window fonts.
The inq_font() primitive retrieves the active normal and/or italic font of the current running GriefEdit image.
Only available when running under a suitable windowing system, otherwise this primitive is a no-op.
| normalfont | Optional string variable reference to be populated with the normal text font name. |
| italicfont | Optional string variable reference to be populated with the italic text font name. |
The inq_font() primitive returns zero or greater on success, otherwise -1 on error.
GriefEdit extended.
string inq_message()
Retrieve the prompt line.
The inq_message() primitive returns the string that is currently displayed on the command prompt.
none
The inq_message() primitive returns a string being what is currently displayed on the message line.
n/a
int inq_prompt()
Retrieve the prompt status.
The inq_prompt() primitive retrieves the prompt status flag, which can be used to detrmine whether the user prompt is current active.
none
The inq_prompt() primitive returns a boolean value stating whether or not the user is currently being prompted for input on the command line.
n/a
int inq_screen_size( [int &rows], [int &cols], [int &colors] )
Determine screen dimensions.
The inq_screen_size() primitive retrieves the screen dimensions, being the number of text rows and character columns.
| rows | Optional integer reference populated with the number of text rows. |
| cols | Optional integer reference to be populated with the number of character columns. |
| colors | Optional integer reference populated with the color depth supported by the display. |
The inq_screen_size() primitive returns zero if terminal is configured as a monochrome screen, or non-zero if in color mode.
GriefEdit extended.
int inq_window_color( [int winnum] )
Retrieve the window attribute.
The inq_window_color returns the background and foreground colors of a window. If winnum is not specified then the colors of the current window are returned.
If the window color is set to < 0, then the default background color will be used. If the color is set to >= 0 then the specified color will be used.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
Returns the current window attribute, otherwise -1 on error.
Unlike BRIEF the assigned attributes is returned, whereas BRIEF returned an encoded colorl the foreground were the lower 4 bits (nibble) and the background was the upper 4 bits.
int inq_window_priority( [int winnum] )
Retrieve the windows display priority.
The inq_window_priority() primitive retrieves the display priority of the specified window, , if omitted the current window.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
Window priority, otherwise -1 on error.
A GriefEdit extension.
int inq_window_size()
Retrieve the window size.
The inq_window_size() primitive determines the size of the current window.
| height | An integer variable which shall be populated with the window height in lines. |
| width | An integer variable which shall be populated with the window width height in lines. |
| left_offset | An integer variable which shall be populated with the number of columns that the window has been scroll horizontally, being the number of columns to the left. |
| lmargin | An integer variable which shall be populated with the window left margin in lines. |
| rmargin | An integer variable which shall be populated with the window right margin in lines. |
The inq_window_size() primitive returns the window height in rows, otherwise -1 if there is no current window.
The margins left and right are GriefEdit extensions.
create_window, inq_window, inq_window_info, inq_window_color
int screen_dump( string filename )
Dump an image of the screen.
The screen_dump() primitive dumps a text representation of the current screen image to the specified file. The resulting image omits both attribute and character-map associations with the view, with frame characters mapped to their ASCII equivalent.
| filename | Optional string containing the full path of the output filename, if omitted the path /tmp/griefscreen.### shall be used; where ### represents the next available sequential filename. |
Returns 0 on success, otherwise -1 on error. When an error has occurred, errno contains a value indicating the type of error that has been detected.
n/a
int set_color( [list|string spec], [int create = TRUE] )
Set screen colors.
The set_color() primitive controls the colors that are utilised on a color display; the values are ignored for monochrome displays.
It is designed to compliment and enhance the functionality of the color primitive, with color() being a user level interface and set_color() being a script level interface.
| spec | Color specification, either a list or comma separated set of attributes. The specification may use one of two forms, firstly an explicit set of attributes pairs or secondary as an implicit list of colors, see below. |
| create | Optional boolean flag, if either omitted or true non-existent attributes shall be created. |
The specification may take one of the following forms. For details on available attributes and possible colors, see the Color Attributes and Color Name sections below.
Explicit:
A list of strings containing attribute color pairs Simple attributes are assigned a color delimited by a = take the form:
"attribute=color"
For the highlight and syntax attributes an extended form permits explicit selection of the background over the implied default of background in additional to optional style settings, as follows:
"attr=color[:style][,background]"
Implicit:
An ordered list of strings corresponding to each color attribute to be set, using the form:
"color-name color-name ..."
A value of NULL in the list means to skip the assignment of the related attribute. An integer value within the list allows the index reference to be explicitly set for subsequent attribute assignment.
Note, provided primary for CRisP compatibility as the explicit interface is the recommended use of the set_color primitive to guard against future enhancements/color attributes.
Also note as the color interfaces have developed independently the COL enumeration values differ.
A special attribute scheme sets the default color scheme, taking the form:
scheme=d[ark]|l[ight]
The following color names are recognised which are case-insensitive, with the color number used which are available on most systems. The first name listed shall be the primary name as returned from inquiry functions ((see get_color )) with the additional as aliases.
| Color |
Constant |
Aliases |
|---|---|---|
| Black |
BLACK |
|
| Blue |
BLUE |
|
| green |
GREEN |
|
| Cyan |
CYAN |
|
| Red |
RED |
|
| Magenta |
MAGENTA |
|
| Brown |
BROWN |
|
| White |
WHITE |
|
| Grey |
GREY |
Gray |
| Light-blue |
LTBLUE |
LightBlue |
| Light-green |
LTGREEN |
LightGreen |
| Light-cyan |
LTCYAN |
LightCyan |
| Light-red |
LTRED |
LightRed |
| Light-magenta |
LTMAGENTA |
LightMagenta |
| Yellow |
YELLOW |
|
| Light-white |
LTWHITE |
LightWhite |
| Bright-white |
LTWHITE |
|
| Light-grey |
LTWHITE |
LightGrey |
| Light-gray |
LTWHITE |
LightGray |
| Dark-grey |
DKGREY |
DarkGrey |
| Dark-gray |
DKGREY |
DarkGray |
| Dark-blue |
DKBLUE |
DarkBlue |
| Dark-green |
DKGREEN |
DarkGreen |
| Dark-cyan |
DKCYAN |
Darkcyan |
| Dark-red |
DKRED |
DarkRed |
| Dark-magenta |
DKMAGENTA |
DarkMagenta |
| Dark-yellow |
DKYELLOW |
DarkYellow |
| Light-yellow |
LTYELLOW |
LightYellow |
plus the following specials to support black-white and terminal features:
| Color |
Description |
|---|---|
| Normal |
Normal terminal text. |
| Inverse |
Inverse contrast. |
| Blink |
Blinking text. |
| Reverse |
Reverse contrast. |
| Standout |
Stand-out terminal text. |
| Dim |
Dim colors. |
Under environments which support a larger color range, examples include xterm256 and WIN32+, the following additional system colors are available. Either by its color values (e.g. 0x32) or by its Red, Green and Blue (RGB) value.
The format is “#rrggbb” being hexadecimal value in range 00-ff, where:
| rr | is the Red value. |
| gg | is the Green value. |
| bb | is the Blue value. |
There are a number of display attributes which can be assigned specific colors. These attributes represent a number of different display objects from basis editing, syntax hiliting and dialog.
The table below lists all the attributes, their manifest-constant within the set_color and get_color interface and description:
| Name |
Constant |
Description |
|---|---|---|
| background |
COL_BACKGROUND |
Background color. |
| normal |
COL_NORMAL_FG |
Normal text. |
| select |
COL_SELECT_FG |
Title of selected window. |
| message |
COL_MESSAGE_FG |
Prompt, messages and status fields. |
| error |
COL_ERROR_FG |
Error messages. |
| hilite |
COL_HILITE_BG |
Highlighted/marked background. |
| hilite |
COL_HILITE_FG |
Highlighted foreground. |
| frame |
COL_BORDERS |
Window frame/borders. |
| cursor_insert |
COL_INSERT_CURSOR |
Insert mode cursor. |
| cursor_overtype |
COL_OVERTYPE_CURSOR |
Over-type mode cursor. |
| cursor |
n/a |
|
| cursor_row |
n/a |
|
| cursor_col |
n/a |
|
| shadow |
COL_SHADOW |
|
| prompt |
COL_PROMPT |
|
| prompt_standout |
n/a |
|
| prompt_complete |
COL_COMPLETION |
|
| question |
COL_QUESTION |
|
| echo_line |
COL_ECHOLINE |
|
| standout |
COL_STANDOUT |
|
| literalchar |
n/a |
|
| whitespace |
n/a |
Highlighted white-space/tabs. |
| scrollbar |
n/a |
|
| scrollbar_thumb |
n/a |
|
| column_status |
n/a |
|
| column_lineno |
n/a |
Line numbers. |
| nonbuffer |
n/a |
|
| search |
n/a |
|
| search_inc |
n/a |
|
| search_match |
n/a |
|
| ruler |
n/a |
|
| ruler_margin |
n/a |
|
| ruler_ident |
n/a |
|
| ruler_mark |
n/a |
|
| ruler_column |
n/a |
|
| popup_normal |
n/a |
|
| popup_hilite |
n/a |
|
| popup_standout |
n/a |
|
| popup_title |
n/a |
|
| popop_frame |
n/a |
|
| dialog_normal |
n/a |
|
| dialog_focus |
n/a |
|
| dialog_hilite |
n/a |
|
| dialog_greyed |
n/a |
|
| dialog_hotkey_normal |
n/a |
|
| dialog_hotkey_focus |
n/a |
|
| dialog_frame |
n/a |
|
| dialog_title |
n/a |
|
| dialog_scrollbar |
n/a |
|
| dialog_thumb |
n/a |
|
| dialog_but_greyed |
n/a |
|
| dialog_but_normal |
n/a |
|
| dialog_but_focus |
n/a |
|
| dialog_but_key_normal |
n/a |
|
| dialog_but_key_focus |
n/a |
|
| dialog_edit_greyed |
n/a |
|
| dialog_edit_normal |
n/a |
|
| dialog_edit_focus |
n/a |
|
| dialog_edit_complete |
n/a |
|
| lsdirectory |
n/a |
|
| lsexecute |
n/a |
|
| lssymlink |
n/a |
|
| lspipe |
n/a |
|
| lsspecial |
n/a |
|
| lserror |
n/a |
|
| lsreadonly |
n/a |
|
| lsnormal |
n/a |
|
| lsattribute |
n/a |
|
| lssize |
n/a |
|
| modified |
n/a |
|
| additional |
n/a |
|
| difftext |
n/a |
|
| diffdelete |
n/a |
|
| match |
n/a |
|
| link |
n/a |
|
| tag |
n/a |
|
| alert |
n/a |
|
| ansi_bold |
n/a |
|
| ansi_underline |
n/a |
|
| spell |
n/a |
|
| spell_local |
n/a |
|
| spell_special |
n/a |
|
| comment |
n/a |
Language comments. |
| comment_standout |
n/a |
|
| todo |
n/a |
|
| code |
n/a |
|
| constant |
n/a |
|
| constant_standout |
n/a |
|
| string |
n/a |
Language string elements. |
| character |
n/a |
|
| operator |
n/a |
Language operator elements. |
| number |
n/a |
Language numeric values. |
| float |
n/a |
|
| delimiter |
n/a |
Language delimiter elements. |
| word |
n/a |
|
| boolean |
n/a |
|
| preprocessor |
n/a |
Language preprocesor elements. |
| preprocessor_define |
n/a |
|
| preprocessor_include |
n/a |
|
| preprocessor_conditional |
n/a |
|
| preprocessor_keyword |
n/a |
|
| preprocessor_word |
n/a |
|
| keyword |
n/a |
Language keywords, primary. |
| keyword_function |
n/a |
|
| keyword_extension |
n/a |
|
| keyword_type |
n/a |
|
| keyword_storageclass |
n/a |
|
| keyword_definition |
n/a |
|
| keyword_conditional |
n/a |
|
| keyword_repeat |
n/a |
|
| keyword_exception |
n/a |
|
| keyword_debug |
n/a |
|
| keyword_label |
n/a |
|
| keyword_structure |
n/a |
|
| keyword_typedef |
n/a |
|
| user1 |
n/a |
User specified 1 |
| user2 |
n/a |
User specified 2 |
| user3 |
n/a |
User specified 3 |
| user4 |
n/a |
User specified 4 |
| user5 |
n/a |
User specified 5 |
| user6 |
n/a |
User specified 6 |
| user7 |
n/a |
User specified 7 |
| user8 |
n/a |
User specified 8 |
| user9 |
n/a |
User specified 9 |
| user10 |
n/a |
User specified 10 |
| window1 |
n/a |
|
| window2 |
n/a |
|
| window3 |
n/a |
|
| window4 |
n/a |
|
| window5 |
n/a |
|
| window6 |
n/a |
|
| window7 |
n/a |
|
| window8 |
n/a |
|
| window9 |
n/a |
|
| window10 |
n/a |
|
| window11 |
n/a |
|
| window12 |
n/a |
|
| window13 |
n/a |
|
| window14 |
n/a |
|
| window15 |
n/a |
|
| window16 |
n/a |
The following styles are recognised which are case-insensitive.
| Featuree |
Description |
|---|---|
| Underline |
Underlined text. |
| Italic |
Italic typeface. |
| Bold |
Bold typeface. |
| Italic |
Italic typeface. |
| Underline |
Under lined text. |
| Undercurl |
Curly underline, generally underline. |
The set_color() primitive returns 0 on success, otherwise -1 -1 on failure to set colors.
A GriefEdit extension.
void set_echo_format( [string format = NULL] )
Set the echo line format.
The set_echo_format() primitive sets or clears the current status area format specification. The format shall be applied to the echo-line overriding the fixed layout implied by echo_line
The status area layout can be defined by one of two means. The echo_line specification controls the elements visible using a fixed layout whereas set_echo_format allows a user defined format specification.
The following example specification
"grief %v: %b (%m) %l %c %t"
results in
grief v2.6.1: (-rw-rw-rw-rw) Line: 165 Col: 1 3:14pm
The echo-line format is applied when the E_FORMAT flag is enabled (See: echo_line). Setting an echo line format implies E_FORMAT similarly clearing the format disables E_FORMAT.
When errors are encountered while evaluating the format specification the incorrect section shall be simply echoed within the echo-line; otherwise screen updating would loop.
| format | Optional echo line format specified, if omitted the format is cleared the current echo_line shall take effect. |
A format specification, which consists of optional and required fields, has the following form:
%[flags][modifier]<type>
Each field of the format specification is a single character or a number signifying a particular format option. The simplest format specification contains only the percent sign and a type character (for example, %b). If a percent sign is followed by a character that has no meaning as a format field, the character is simply copied. For example, to print a percent-sign character, use %%.
The optional fields, which appear before the type character, control other aspects of the formatting, as follows:
| type | Required character that determines whether the associated argument is interpreted as a character, a string, or a number. |
| flags | Optional character or characters that control justification of output and printing of signs, blanks, decimal points, and octal and hexadecimal prefixes. More than one flag can appear in a format specification. |
| modifier | Optional number that specifies a format modifier, selected an alternative form of the associated type. If omitted the modifier assumes a value of 0. |
Following is a description of the possible echo-line attributes. The second character in “item” is the type:
| Type |
Description |
|---|---|
| b |
Buffer details. |
| f |
Buffer flags. |
| n |
File name with directory. |
| N |
File name without the directory. |
| p |
Percent string. |
| c |
Column number. |
| m |
Mode string (i.e. --rw-rw-rw). |
| o |
Overwrite mode, “ OV” otherwise “”. |
| O |
Overwrite/insert flag, like %o yet shows OV/RE. |
| C |
Character value. |
| V |
Virtual character indicator. |
| r |
Remember flag. |
| l |
Line number. |
| L |
Number of lines in the file. |
| t |
Current time. |
| d |
Current date. |
| v |
GRIEF Version. |
| Y |
Current Year. |
| M |
Current month of the year. |
| D |
Current day of the month. |
The following flags are supported;
| Flag |
Description |
Default |
|---|---|---|
| - |
Left align the result within the given field width. |
Right align. |
| + |
Prefix the output value with a sign (+ or -) if the output value is of a signed type. |
Sign appears only for negative signed values (). |
| 0 |
If width is prefixed with 0, zeros are added until the minimum width is reached. If 0 and appear, the 0 is ignored. If 0 is specified with an integer format (i, u, x, X, o, d) the 0 is ignored. |
No padding. |
| <space> |
Prefix the output value with a blank if the output value is signed and positive; the blank is ignored if both the blank and + flags appear. |
No blank appears. |
| format | Echo line format specification, if omitted or an empty string the specification is cleared. |
nothing
A GriefEdit extension.
int set_window_priority( int priority, [int winnum] )
Set the window display priority.
The set_window_priority() primitive sets the display priority of the specified window, if omitted the current window. The priority controls the display order of pop-up windows.
| priority | Window priority between the range of 0 .. 127. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
Returns the previous window priority, otherwise -1 on error.
A GriefEdit extension.
int use_tab_char( [int|string yesno], [int global = FALSE] )
Configure use of hard/soft tabs.
The use_tab_char() primitive controls whether hard or soft tabs shall be utilised within buffers. When enabled hard/physical tab characters shall be inserted into the buffer otherwise one or more space characters are inserted up-to the next indentation/tab stop.
The effected tabs setting shall either be the current buffer if global is given as FALSE or omitted, otherwise the global configuration setting which is referenced during buffer creation defining the default of subsequent buffers.
The argument yesno states the new tab setting value as either a string or an integer flag. If omitted the user shall be prompted as follows:
Fill with tab chars [yes,no]?
| yesno | Optional string or integer containing the required status. A string value of yes enables with no disabling. An integer of 1 enables, 0 disables and -1 returns the current with effecting any change. |
| global | Optional integer flag states the effected resource, if FALSE or omitted then the current buffer otherwise the global buffer default. |
The use_tab_char() primitive returns the previous tab setting of the selected resource, either the current buffer or the global.
n/a
int view_screen()
View the content of underlying screen.
The view_screen() primitive restores the original screen image visible prior to Grief’s execution, returning upon a key press.
none
The view_screen() primitive returns zero on success otherwise -1 on error.
A GriefEdit extension.
int window_color( [int color|string color], [int winnum] )
Set the window attribute.
The window_color() primitive sets the background of the specified window otherwise if omitted the current window to the stated color.
When borders are disabled, this color shall be used as the background of the associated window allowing one to distinguish between individual views.
| color | Can be either an integer containing the color numeric value or a string containing the color name. If omitted, the next color within the color index sequenence shall be assigned, see color_index for details. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
Returns non-zero if the color was changed successfully, otherwise zero.
n/a
$Id: $
To send feedback on this topic email: griefedit@gmail.com
Copyright © Adam Young All Rights Reserved.
Set window border status.
int borders( [int borders] )
Set the basic colors.
int color( [int background], [int normal], [int selected], [int message], [int error], [int hilite], [int hilite_fg], ... )
Copy the current screen.
void copy_screen()
Control cursor display.
int cursor( int state )
Set/retrieve display control flags.
int display_mode( [int or_mask|string set-list], [int and_mask|string clear-list], [int scroll_cols], [int scroll_rows], [int visible_cols], [int visible_rows], [int number_cols] )
Control window display.
int display_windows( [int mode] )
Set echo line flags.
int echo_line( [int flags] )
Terminal line display.
int ega( int lines )
Retrieve screen colors.
list get_color( [int flags = 0] )
Retrieve the border status.
int inq_borders()
Retrieve the command line message.
string inq_cmd_line()
Retrieve the basic colors.
string inq_color( [int &background], [int &normal], [int &selected], [int &messages], [int &errors], [int &hilite], [int &hilite_fg] )
Retrieve name of last keyboard command.
string inq_command()
Inquire display control flags.
int inq_display_mode( [string flagname], [string ~flags] )
Retrieve the echo-line format.
int inq_echo_format()
Retrieve the echo-line flags.
int inq_echo_line()
Inquire the current window fonts.
int inq_font( string & normalfont, [string &italicfont] )
Retrieve the echo_line content.
string inq_line_col()
Retrieve the prompt line.
string inq_message()
Retrieve the prompt status.
int inq_prompt()
Determine screen dimensions.
int inq_screen_size( [int &rows], [int &cols], [int &colors] )
Retrieve the window attribute.
int inq_window_color( [int winnum] )
Retrieve the windows display priority.
int inq_window_priority( [int winnum] )
Retrieve the window size.
int inq_window_size()
Redraw screen.
void redraw( [int winch] )
Update the display.
void refresh()
Dump an image of the screen.
int screen_dump( string filename )
Set screen colors.
int set_color( [list|string spec], [int create = TRUE] )
Set the echo line format.
void set_echo_format( [string format = NULL] )
Set the window display priority.
int set_window_priority( int priority, [int winnum] )
Configure use of hard/soft tabs.
int use_tab_char( [int|string yesno], [int global = FALSE] )
View the content of underlying screen.
int view_screen()
Set the window attribute.
int window_color( [int color|string color], [int winnum] )
Property change event.
void _chg_properties()
Set a specific color.
void set_color_pair( string|int ident, [int|string fg], [int|string bg], [int|string sf] )
Retrieve the specific color.
void get_color_pair( string name|int ident, [int|string fg], [int|string bg], [int|string sf] )
Buffer to buffer transfer.
int transfer( int bufnum, int sline, [int scolumn], int eline, [int ecolumn] )
Bitwise complement.
~expr
Set the current window fonts.
int set_font( [string normalfont], [string italicfont] )
Creates a tiled window.
int create_tiled_window( int lx, int by, int rx, int ty, [int bufnum] )
Set a terminal attribute.
int set_term_feature( int|string ident, [string|int value] )
Border color background color index.
int color_index( [int index] )
Issue an error message on the command line.
int error( string format, ... )
Display a message on the command line.
int message( string format, ... )
Retrieve the value of a macro parameter.
int get_parm( [int argument], declare & symbol, [string prompt], [int length = MAXPROMPT], [declare default], [int one = FALSE] )
Create a popup window.
int create_window( int lx, int by, int rx, int ty, [string message] )
Retrieve the current window.
int inq_window()
Retrieve the current window information.
int inq_window_info( [int &winnum], [int &bufnum], [int &lx], [int &by], [int &rx], [int &ty], [string &title = NULL], [string &message = NULL] )
Last system errno number.
extern int errno;
Print formatted string to stdout.
int print()
Set buffer tab stops.
int tabs( [string tabs | list tabs | int tab, ...] )
Retrieves the buffer tab specification.
string|list inq_tabs( [int bufnum], [int min_count], [int aslist = FALSE] ))