martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.23k stars 256 forks source link

What are valid style ids? #885

Closed erf closed 3 years ago

erf commented 3 years ago

What are valid style ids when setting this:

http://martanne.github.io/vis/doc/index.html#Window:style_define

Is it just in the range:

    UI_STYLE_LEXER_MAX = 64,
    UI_STYLE_DEFAULT,
    UI_STYLE_CURSOR,
    UI_STYLE_CURSOR_PRIMARY,
    UI_STYLE_CURSOR_LINE,
    UI_STYLE_SELECTION,
    UI_STYLE_LINENUMBER,
    UI_STYLE_LINENUMBER_CURSOR,
    UI_STYLE_COLOR_COLUMN,
    UI_STYLE_STATUS,
    UI_STYLE_STATUS_FOCUSED,
    UI_STYLE_SEPARATOR,
    UI_STYLE_INFO,
    UI_STYLE_EOF,
    UI_STYLE_MAX,

Or can i use ids out side this range to not interfer with the lexer style if i want to override some style.

Not quite sure how this works..

I would like to style multiple patterns in vis-highlight

martanne commented 3 years ago

Hi, it is an integer in range of [0, UI_STYLE_MAX-1]. There is currently no mechanism in place to avoid conflicts. The lexers will generally use/define styles starting from zero. Hence, I would use custom styles starting from the other end i.e. with UI_STYLE_LEXER_MAX and count down towards zero.