From 7996c1fa2d68251430a5007e97ef4e8f39429a26 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 3 Oct 2015 22:33:13 -0700 Subject: linenoise: substring flag in completion callback. A feature is hereby introduced into linenoise whereby completion mode can be entered via Ctrl-X Tab also, not only Tab. This is distinguished with a flag in the completion structure. The intent is that the callback can use this to provide substring matches not only prefix matches. * linenoise/linenoise.c (complete_line): Takes a new argument, and stores it in the new substring member of lino_completions_t. (edit): If Tab is typed while in Ctrl-X extended mode, then fall through to the regular switch, where the TAB case now recognizes that it is in extended mode and passes the mode flag to complete_line. * linenoise/linenoise.h (lino_completions_t): New member, substring. --- linenoise/linenoise.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linenoise/linenoise.h') diff --git a/linenoise/linenoise.h b/linenoise/linenoise.h index 94cf3913..b6919254 100644 --- a/linenoise/linenoise.h +++ b/linenoise/linenoise.h @@ -50,6 +50,7 @@ typedef struct lino_state lino_t; typedef struct lino_completions { size_t len; char **cvec; + int substring; } lino_completions_t; typedef void lino_compl_cb_t(const char *, lino_completions_t *, void *ctx); -- cgit v1.2.3