The user can interrogate the current window to determine the color highlighting used on a particular piece of text. The following functions provide information on the highlighting pattern against which text at a particular position has been matched, its style, color and font attributes (whether the font is supposed to be bold and/or italic).
These macro functions permit macro writers to generate formatted output which allows NEdit-ng highlighting to be reproduced. This is suitable for the generation of HTML or Postscript output, for example.
Note that if any of the functions is used while in Plain mode or while syntax highlighting is off, the behaviour is undefined.
-
get_pattern_by_name( pattern_name )
Returns an array containing the pattern attributes for patternpattern_name
. The elements in this array are:style
Highlight style name
If
pattern_name
is invalid, an empty array is returned. -
get_pattern_at_pos( pos )
Returns an array containing the pattern attributes of the character at positionpos
. The elements in this array are:pattern
Highlight pattern namestyle
Highlight style nameextent
The length in the text which uses the same highlighting pattern
The
extent
value is measured from positionpos
going right/down (forward in the file) only.If
pos
is invalid, an empty array is returned. -
get_style_by_name( style_name )
Returns an array containing the style attributes for stylestyle_name
. The elements in this array are:bold
1
if style is bold,0
otherwiseitalic
1
if style is italic,0
otherwisecolor
Name of the style's colorbackground
Name of the background color, if any
The colors use the names specified in the color definitions for the style. These will either be names matching those the X server recognises, or RGB (red/green/blue) specifications.
If
style_name
is invalid, an empty array is returned. -
get_style_at_pos( pos )
Returns an array containing the style attributes of the character at positionpos
. The elements in this array are:style
Name of the highlight stylebold
1
if style is bold,0
otherwiseitalic
1
if style is italic,0
otherwisecolor
Name of the style's colorrgb
Color's RGB values ('#rrggbb')background
Name of the background color, if anyback_rgb
Background color's RGB values ('#rrggbb')extent
The length in the text which uses the same highlight style
The colors use the names specified in the color definitions for the style. These will either be names matching those the display server recognises, or RGB specifications. The values for
rgb
andback_rgb
contain the actual color values allocated by the display server for the window. If the display cannot match the specified (named) color exactly, the RGB values in these entries may not match the specified ones.The
extent
value is measured from positionpos
going right/down (forward in the file) only.If
pos
is invalid, an empty array is returned.