isocline
Syntax Highlighting

Basic syntax highlighting. More...

Typedefs

typedef struct ic_highlight_env_s ic_highlight_env_t
 
typedef void() ic_highlight_fun_t(ic_highlight_env_t *henv, const char *input, void *arg)
 A syntax highlighter callback that is called by readline to syntax highlight user input. More...
 
typedef char *() ic_highlight_format_fun_t(const char *s, void *arg)
 Experimental: Convenience callback for a function that highlights s using bbcode's. More...
 

Functions

void ic_set_default_highlighter (ic_highlight_fun_t *highlighter, void *arg)
 Set a syntax highlighter. More...
 
void ic_highlight (ic_highlight_env_t *henv, long pos, long count, const char *style)
 Set the style of characters starting at position pos. More...
 
void ic_highlight_formatted (ic_highlight_env_t *henv, const char *input, const char *formatted)
 Experimental: Convenience function for highlighting with bbcodes. More...
 

Detailed Description

Basic syntax highlighting.

Typedef Documentation

◆ ic_highlight_env_t

typedef struct ic_highlight_env_s ic_highlight_env_t

◆ ic_highlight_format_fun_t

typedef char*() ic_highlight_format_fun_t(const char *s, void *arg)

Experimental: Convenience callback for a function that highlights s using bbcode's.

The returned string should be allocated and is free'd by the caller.

◆ ic_highlight_fun_t

typedef void() ic_highlight_fun_t(ic_highlight_env_t *henv, const char *input, void *arg)

A syntax highlighter callback that is called by readline to syntax highlight user input.

Function Documentation

◆ ic_highlight()

void ic_highlight ( ic_highlight_env_t henv,
long  pos,
long  count,
const char *  style 
)

Set the style of characters starting at position pos.

◆ ic_highlight_formatted()

void ic_highlight_formatted ( ic_highlight_env_t henv,
const char *  input,
const char *  formatted 
)

Experimental: Convenience function for highlighting with bbcodes.

Can be called in a ic_highlight_fun_t callback to colorize the input using the the provided formatted input that is the styled input with bbcodes. The content of formatted without bbcode tags should match input exactly.

◆ ic_set_default_highlighter()

void ic_set_default_highlighter ( ic_highlight_fun_t highlighter,
void *  arg 
)

Set a syntax highlighter.

There can only be one highlight function, setting it again disables the previous one.