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_nameis 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
extentvalue is measured from positionposgoing right/down (forward in the file) only.If
posis 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
1if style is bold,0otherwiseitalic
1if style is italic,0otherwisecolor
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_nameis 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
1if style is bold,0otherwiseitalic
1if style is italic,0otherwisecolor
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
rgbandback_rgbcontain 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
extentvalue is measured from positionposgoing right/down (forward in the file) only.If
posis invalid, an empty array is returned.