Screen Primitives

Summary
Screen Primitives
Macros
bordersSet window border status.
colorSet the basic colors.
copy_screenCopy the current screen.
cursorControl cursor display.
display_modeSet/retrieve display control flags.
display_windowsControl window display.
echo_lineSet echo line flags.
egaTerminal line display.
get_colorRetrieve screen colors.
inq_bordersRetrieve the border status.
inq_cmd_lineRetrieve the command line message.
inq_colorRetrieve the basic colors.
inq_commandRetrieve name of last keyboard command.
inq_display_modeInquire display control flags.
inq_echo_formatRetrieve the echo-line format.
inq_echo_lineRetrieve the echo-line flags.
inq_fontInquire the current window fonts.
inq_line_colRetrieve the echo_line content.
inq_messageRetrieve the prompt line.
inq_promptRetrieve the prompt status.
inq_screen_sizeDetermine screen dimensions.
inq_window_colorRetrieve the window attribute.
inq_window_priorityRetrieve the windows display priority.
inq_window_sizeRetrieve the window size.
redrawRedraw screen.
refreshUpdate the display.
screen_dumpDump an image of the screen.
set_colorSet screen colors.
set_echo_formatSet the echo line format.
set_window_prioritySet the window display priority.
use_tab_charConfigure use of hard/soft tabs.
view_screenView the content of underlying screen.
window_colorSet the window attribute.

Macros

borders

int borders([int borders])

Set window border status.

Description

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.

Parameters

bordersAn 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.

Returns

An integer boolean value representing the previous border state.

Portability

n/a

See Also

inq_borders, _chg_properties

color

int color([int background],
[int normal],
 [int selected],
[int message],
[int error],
 [int hilite],
[int hilite_fg],
...)

Set the basic colors.

Description

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:

Basic Colors
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.

Parameters

backgroundThe background color.
normalThe normal text color.
selectedHighlighting color for the selected window title.
messageThe color for normal messages.
errorThe color for error messages.
hiliteColor 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_fgForeground color of marked areas.

Returns

The color() primitive returns 1 on success, otherwise 0 if one or more of the colors is invalid.

Example

Set the background color to blue and the foreground color to white, and active window title to bright cyan.

color(1, 7, 11);

Portability

Colors definitions beyond frame are system dependent.

See Also

get_color, get_color_pair

copy_screen

void copy_screen()

Copy the current screen.

Description

The copy_screen() primitive exports an image of the current editor windows to the current buffer.

Parameters

none

Returns

nothing

Portability

A GriefEdit extension; this primitive is subject for removal, and has been removed from recent CrispEdit™ releases.

See Also

transfer

cursor

int cursor(int state)

Control cursor display.

Description

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.

Parameters

stateOptional boolean cursor status, if omitted the current status is toggled.

Returns

The cursor() primitive returns 0 on success, otherwise non-zero.

Portability

A GriefEdit extension.

See Also

inq_screen_size, borders

display_mode

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.

Description

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.

Note:

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.

Parameters

set_maskOptional 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_maskOptional 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_colsOptional 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_rowsOptional 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_colsOptional integer value, if stated sets the lower bounds of the display arena width.  Upon a negative value, the current override shall be returned.
visible_rowsOptional integer value, if stated sets the lower bounds of the display arena height.  Upon a negative value, the current override shall be returned.
number_colsOptional 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.

Returns

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.

Portability

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.

See Also

inq_display_mode, set_font, inq_font

display_windows

int display_windows([int mode])

Control window display.

Description

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.

Parameters

modeOptional integer, if specified states the new display mode, otherwise if omitted the current display mode is toggled.

Returns

The display_window() primitive returns the previous status.

Portability

Unlike BRIEF existing tiled windows are not destroyed upon the initial mode change.

See Also

create_tiled_window

echo_line

int echo_line([int flags])

Set echo line flags.

Description

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

Parameters

flagsOptional 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.
Flags
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.

Active Character

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.

Virtual Character

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.

XVirtual 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.
Buffer Coordinates

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).

Cursor Mode

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.

Remember Status

The E_REMEMBER element represents the remember status.

When macro recording is active or paused, RE and PA respectively are displayed.

Time

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.

Returns

The echo_line() primitive returns the previous flags value.

Portability

n/a

See Also

inq_line_col, inq_prompt, set_echo_format, inq_echo_format

ega

int ega(int lines)

Terminal line display.

Description

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.

  • 60 x 80
  • 50 x 80
  • 43 x 80
  • 25 x 80

Parameters

linesOptional 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.

Notes!

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)

Returns

The ega() primitive returns the previous status, otherwise -1 upon an error.

Portability

A GriefEdit extension.

See Also

set_term_feature

get_color

list get_color([int flags = 0])

Retrieve screen colors.

Description

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>
idNumeric identifier of the attribute.
flagsControl flags.
nameAttribute name.
specColor specification.

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

Parameters

flagsOptional integer flags, one or more of the following flags OR’ed together control the components to be reported against each attribute.
Flags
Constant
Definition
COLORGET_FVALUE
Attribute numeric value/identifier.
COLORGET_FFLAGS
Type flags.
COLORGET_FNAME
Name.

Returns

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

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"
:
:

Portability

A GriefEdit extension.

See Also

color, inq_color, set_color

inq_borders

int inq_borders()

Retrieve the border status.

Description

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.

Parameters

none

Returns

Returns non-zero if windows borders are enabled, otherwise zero if disabled.

Portability

n/a

See Also

borders, color_index

inq_cmd_line

string inq_cmd_line()

Retrieve the command line message.

Description

The inq_cmd_line() primitive returns the current prompt response displayed on the message line.

Parameters

none

Returns

The inq_cmd_line returns a string containing the current prompt.

Portability

n/a

See Also

inq_message

inq_color

string inq_color([int &background],
[int &normal],
 [int &selected],
[int &messages],
[int &errors],
 [int &hilite],
[int &hilite_fg])

Retrieve the basic colors.

Description

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.

Parameters

backgroundBackground color.
normalNormal text color.
selectedHighlighting color for the selected window title.
messageNormal messages.
errorError messages.
hiliteColor 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_fgForeground color of marked areas.
frameWindow frame.

Returns

The inq_color() primitive returns a string containing the current color specification, being a space seperated list of color names

Portability

n/a

See Also

color, get_color

inq_command

string inq_command()

Retrieve name of last keyboard command.

Description

The inq_command() primitive retrieves the name of last command invoked from keyboard.

Commands with names beginning with an underscore (_) are ignored.

Parameters

none

Returns

The inq_command() primitive returns a string containing the name of the last macro called by the user.

Portability

n/a

See Also

inq_message

inq_display_mode

int inq_display_mode([string flagname],
[string ~flags])

Inquire display control flags.

Description

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.

Parameter

flagnameOptional string parameter, if stated gives the name of the attribute to be retrieved (See: display_mode).  If omitted the display mode are retrieved.
flagsOptional string parameter, if stated shall be populated with a comma separated list of active attribute names.

Returns

The inq_display_mode() primitive returns the value of the associated attribute, otherwise -1 on error.

Portability

GriefEdit extended.

For system portability use of the manifest constants is advised.

See Also

display_mode, set_font, inq_font

inq_echo_format

int inq_echo_format()

Retrieve the echo-line format.

Description

The inq_echo_format() primitive retrieves the current echo-line format specification.

Parameters

none

Returns

The inq_echo_format returns the current echo line format specification string, otherwise an empty string.

Portability

A GriefEdit extension.

See Also

set_echo_format, echo_line, inq_echo_line

inq_echo_line

int inq_echo_line()

Retrieve the echo-line flags.

Description

The inq_echo_line() primitive retrieves the current echo-line flags.

Parameters

none

Returns

The inq_echo_line() primitive returns the current echo_line flags.

Portability

A GriefEdit extension.

See Also

set_echo_format, inq_echo_format, echo_line

inq_font

int inq_font(string &normalfont,
 [string &italicfont])

Inquire the current window fonts.

Description

The inq_font() primitive retrieves the active normal and/or italic font of the current running GriefEdit image.

Note:

Only available when running under a suitable windowing system, otherwise this primitive is a no-op.

Parameters

normalfontOptional string variable reference to be populated with the normal text font name.
italicfontOptional string variable reference to be populated with the italic text font name.

Returns

The inq_font() primitive returns zero or greater on success, otherwise -1 on error.

Portability

GriefEdit extended.

See Also

set_font

inq_line_col

string inq_line_col()

Retrieve the echo_line content.

Description

The inq_line_col() primitive retrieves the current content of the echo_line.

Parameters

none

Returns

The inq_line_col() primitive returns the current echo line status.

Portability

n/a

See Also

inq_cmd_line

inq_message

string inq_message()

Retrieve the prompt line.

Description

The inq_message() primitive returns the string that is currently displayed on the command prompt.

Parameters

none

Returns

The inq_message() primitive returns a string being what is currently displayed on the message line.

Portability

n/a

See Also

inq_cmd_line, error, message

inq_prompt

int inq_prompt()

Retrieve the prompt status.

Description

The inq_prompt() primitive retrieves the prompt status flag, which can be used to detrmine whether the user prompt is current active.

Parameters

none

Returns

The inq_prompt() primitive returns a boolean value stating whether or not the user is currently being prompted for input on the command line.

Portability

n/a

See Also

get_parm

inq_screen_size

int inq_screen_size([int &rows],
[int &cols],
[int &colors])

Determine screen dimensions.

Description

The inq_screen_size() primitive retrieves the screen dimensions, being the number of text rows and character columns.

Parameters

rowsOptional integer reference populated with the number of text rows.
colsOptional integer reference to be populated with the number of character columns.
colorsOptional integer reference populated with the color depth supported by the display.

Returns

The inq_screen_size() primitive returns zero if terminal is configured as a monochrome screen, or non-zero if in color mode.

Portability

GriefEdit extended.

See Also

display_mode

inq_window_color

int inq_window_color([int winnum])

Retrieve the window attribute.

Description

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.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Returns the current window attribute, otherwise -1 on error.

Portability

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.

See Also

get_color_pair, window_color

inq_window_priority

int inq_window_priority([int winnum])

Retrieve the windows display priority.

Description

The inq_window_priority() primitive retrieves the display priority of the specified window, , if omitted the current window.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Window priority, otherwise -1 on error.

Portability

A GriefEdit extension.

See Also

set_window_priority

inq_window_size

int inq_window_size()

Retrieve the window size.

Description

The inq_window_size() primitive determines the size of the current window.

Parameters

heightAn integer variable which shall be populated with the window height in lines.
widthAn integer variable which shall be populated with the window width height in lines.
left_offsetAn 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.
lmarginAn integer variable which shall be populated with the window left margin in lines.
rmarginAn integer variable which shall be populated with the window right margin in lines.

Returns

The inq_window_size() primitive returns the window height in rows, otherwise -1 if there is no current window.

Portability

The margins left and right are GriefEdit extensions.

See Also

create_window, inq_window, inq_window_info, inq_window_color

redraw

void redraw([int winch])

Redraw screen.

Description

The redraw() primitive redisplays the screen.

Parameters

none

Returns

nothing

Portability

n/a

See Also

refresh

refresh

void refresh()

Update the display.

Description

The refresh() primitive updates the screen flushing any pending changes.

Parameters

none

Returns

nothing

Portability

n/a

See Also

redraw

screen_dump

int screen_dump(string filename)

Dump an image of the screen.

Description

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.

Parameters

filenameOptional 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

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.

Portability

n/a

See Also

print

set_color

int set_color([list|string spec],
[int create = TRUE])

Set screen colors.

Description

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.

Parameters

specColor 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.
createOptional boolean flag, if either omitted or true non-existent attributes shall be created.
Color Specification

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.

Scheme Specification

A special attribute scheme sets the default color scheme, taking the form:

scheme=d[ark]|l[ight]
Color Names

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.
Color Codes

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:

rris the Red value.
ggis the Green value.
bbis the Blue value.
Color Attributes

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
 
Styles

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.

Returns

The set_color() primitive returns 0 on success, otherwise -1 -1 on failure to set colors.

Portability

A GriefEdit extension.

See Also

get_color, color, inq_color, set_color_pair

set_echo_format

void set_echo_format([string format = NULL])

Set the echo line format.

Description

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.

Note:

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.

Parameters

formatOptional echo line format specified, if omitted the format is cleared the current echo_line shall take effect.
Format Specification

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:

typeRequired character that determines whether the associated argument is interpreted as a character, a string, or a number.
flagsOptional 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.
modifierOptional 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.
Modifier
Value
0
Buffer title.
1
Buffer number as decimal.
2
Buffer number as hex.
f
Buffer flags.
Modifier
Value
0
Flags0
1
Flags1
2
Flags2
3
Flags3
4
Flags4
n
File name with directory.
N
File name without the directory.
p
Percent string.
c
Column number.
Modifier
Value
0
Col: xxx
1
xxx
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.
Modifier
Value
0
Line: xxx
1
xxx
L
Number of lines in the file.
t
Current time.
Modifier
Value
0
12 hour
1
24 hour
d
Current date.
Modifier
Value
0
yyyy-mm[m]-dd
1
yy-mm[m]-dd
2
dd-mm[m]-yyyy
3
mm[m]-dd-yyyy
4
dd-mm[m]-yy
5
mm[m]-dd-yy
6
dd-mm[m]
7
mm-dd
v
GRIEF Version.
Y
Current Year.
Modifier
Value
0
YYYY
1
YY
M
Current month of the year.
Modifier
Value
0
MM
1
M[M]
2
Name
3
Abbrev
D
Current day of the month.
Modifier
Value
0
DD
1
D[D]
2
Name
3
Abbrev

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.

Parameters

formatEcho line format specification, if omitted or an empty string the specification is cleared.

Returns

nothing

Portability

A GriefEdit extension.

See Also

inq_echo_format, echo_line, inq_echo_line

set_window_priority

int set_window_priority(int priority,
 [int winnum])

Set the window display priority.

Description

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.

Parameters

priorityWindow priority between the range of 0 ..  127.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Returns the previous window priority, otherwise -1 on error.

Portability

A GriefEdit extension.

See Also

inq_window_priority

use_tab_char

int use_tab_char([int|string yesno],
[int global = FALSE])

Configure use of hard/soft tabs.

Description

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]?

Parameters

yesnoOptional 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.
globalOptional integer flag states the effected resource, if FALSE or omitted then the current buffer otherwise the global buffer default.

Returns

The use_tab_char() primitive returns the previous tab setting of the selected resource, either the current buffer or the global.

Portability

n/a

See Also

tabs, inq_tabs

view_screen

int view_screen()

View the content of underlying screen.

Description

The view_screen() primitive restores the original screen image visible prior to Grief’s execution, returning upon a key press.

Parameters

none

Returns

The view_screen() primitive returns zero on success otherwise -1 on error.

Portability

A GriefEdit extension.

See Also

cursor

window_color

int window_color([int color|string color],
[int winnum])

Set the window attribute.

Description

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.

Parameters

colorCan 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.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Returns non-zero if the color was changed successfully, otherwise zero.

Portability

n/a

See Also

inq_window_color, color_index

$Id: $

To send feedback on this topic email: grie.nosp@m.fedit@gmai.nosp@m.l.com

Copyright © Adam Young All Rights Reserved.

int borders([int borders])
Set window border status.
int color([int background],
[int normal],
 [int selected],
[int message],
[int error],
 [int hilite],
[int hilite_fg],
...)
Set the basic colors.
void copy_screen()
Copy the current screen.
int cursor(int state)
Control cursor display.
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.
int display_windows([int mode])
Control window display.
int echo_line([int flags])
Set echo line flags.
int ega(int lines)
Terminal line display.
list get_color([int flags = 0])
Retrieve screen colors.
int inq_borders()
Retrieve the border status.
string inq_cmd_line()
Retrieve the command line message.
string inq_color([int &background],
[int &normal],
 [int &selected],
[int &messages],
[int &errors],
 [int &hilite],
[int &hilite_fg])
Retrieve the basic colors.
string inq_command()
Retrieve name of last keyboard command.
int inq_display_mode([string flagname],
[string ~flags])
Inquire display control flags.
int inq_echo_format()
Retrieve the echo-line format.
int inq_echo_line()
Retrieve the echo-line flags.
int inq_font(string &normalfont,
 [string &italicfont])
Inquire the current window fonts.
string inq_line_col()
Retrieve the echo_line content.
string inq_message()
Retrieve the prompt line.
int inq_prompt()
Retrieve the prompt status.
int inq_screen_size([int &rows],
[int &cols],
[int &colors])
Determine screen dimensions.
int inq_window_color([int winnum])
Retrieve the window attribute.
int inq_window_priority([int winnum])
Retrieve the windows display priority.
int inq_window_size()
Retrieve the window size.
void redraw([int winch])
Redraw screen.
void refresh()
Update the display.
int screen_dump(string filename)
Dump an image of the screen.
int set_color([list|string spec],
[int create = TRUE])
Set screen colors.
void set_echo_format([string format = NULL])
Set the echo line format.
int set_window_priority(int priority,
 [int winnum])
Set the window display priority.
int use_tab_char([int|string yesno],
[int global = FALSE])
Configure use of hard/soft tabs.
int view_screen()
View the content of underlying screen.
int window_color([int color|string color],
[int winnum])
Set the window attribute.
void _chg_properties()
Property change event.
void set_color_pair(string|int ident,
  [int|string fg],
 [int|string bg],
 [int|string sf])
Set a specific color.
void get_color_pair(string name|int ident,
  [int|string fg],
 [int|string bg],
 [int|string sf])
Retrieve the specific color.
int transfer(int bufnum,
 int sline,
 [int scolumn],
int eline,
 [int ecolumn])
Buffer to buffer transfer.
~expr
Bitwise complement.
int set_font([string normalfont],
[string italicfont])
Set the current window fonts.
int create_tiled_window(int lx,
int by,
int rx,
int ty,
 [int bufnum])
Creates a tiled window.
int set_term_feature(  int|string ident,
 [string|int value])
Set a terminal attribute.
int color_index([int index])
Border color background color index.
int error(string format,
 ...)
Issue an error message on the command line.
int message(string format,
 ...)
Display a message on the command line.
int get_parm( [int argument],
declare &symbol,
  [string prompt],
 [int length = MAXPROMPT],
  [declare default],
 [int one = FALSE])
Retrieve the value of a macro parameter.
int create_window(int lx,
int by,
 int rx,
int ty,
 [string message])
Create a popup window.
int inq_window()
Retrieve the current window.
int inq_window_info([int &winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])
Retrieve the current window information.
extern int errno;
Last system errno number.
int print()
Print formatted string to stdout.
int tabs([string tabs | list tabs | int tab, ...])
Set buffer tab stops.
string|list inq_tabs([int bufnum],
[int min_count],
[int aslist = FALSE]))
Retrieves the buffer tab specification.