isocline
Advanced Completion

Functions

const char * ic_completion_input (ic_completion_env_t *cenv, long *cursor)
 Get the raw current input (and cursor position if cursor != NULL) for the completion. More...
 
void * ic_completion_arg (ic_completion_env_t *cenv)
 Get the completion argument passed to ic_set_completer. More...
 
bool ic_has_completions (ic_completion_env_t *cenv)
 Do we have already some completions? More...
 
bool ic_stop_completing (ic_completion_env_t *cenv)
 Do we already have enough completions and should we return if possible? (for improved latency) More...
 
bool ic_add_completion_prim (ic_completion_env_t *cenv, const char *completion, const char *display, const char *help, long delete_before, long delete_after)
 Primitive completion, cannot be used with most transformers (like ic_complete_word and ic_complete_qword). More...
 

Detailed Description

Function Documentation

◆ ic_add_completion_prim()

bool ic_add_completion_prim ( ic_completion_env_t cenv,
const char *  completion,
const char *  display,
const char *  help,
long  delete_before,
long  delete_after 
)

Primitive completion, cannot be used with most transformers (like ic_complete_word and ic_complete_qword).

When completed, delete_before bytes are deleted before the cursor position, delete_after bytes are deleted after the cursor, and finally completion is inserted. The display is used to display the completion in the completion menu, and help is displayed with hinting. Both display and help can be NULL. (all are copied by isocline and do not need to be preserved or allocated).

Returns true if the callback should continue trying to find more possible completions. If false is returned, the callback should try to return and not add more completions (for improved latency).

◆ ic_completion_arg()

void* ic_completion_arg ( ic_completion_env_t cenv)

Get the completion argument passed to ic_set_completer.

◆ ic_completion_input()

const char* ic_completion_input ( ic_completion_env_t cenv,
long *  cursor 
)

Get the raw current input (and cursor position if cursor != NULL) for the completion.

Usually completer functions should look at their prefix though as transformers like ic_complete_word may modify the prefix (for example, unescape it).

◆ ic_has_completions()

bool ic_has_completions ( ic_completion_env_t cenv)

Do we have already some completions?

◆ ic_stop_completing()

bool ic_stop_completing ( ic_completion_env_t cenv)

Do we already have enough completions and should we return if possible? (for improved latency)