aboutsummaryrefslogtreecommitdiff
path: root/client/rl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/rl.cpp')
-rw-r--r--client/rl.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/client/rl.cpp b/client/rl.cpp
index fa44bf4..f839d96 100644
--- a/client/rl.cpp
+++ b/client/rl.cpp
@@ -119,24 +119,25 @@ int rl_word(const char * line, int cursor) {
return word;
}
+/// \internal
typedef struct {
const char * word;
- const char ** suggestions;
+ const char ** options;
} __rl_complete_list_data_t;
-char** rl_complete_list(const char * word, const char ** suggestions) {
+char** rl_complete_list(const char * word, const char ** options) {
__rl_complete_list_data_t data = {
.word = word,
- .suggestions = suggestions,
+ .options = options,
};
return rl_completion_matches((char *) &data, [](const char * text, int state) -> char * {
__rl_complete_list_data_t data = *(__rl_complete_list_data_t *) text;
static size_t i = 0;
if (state == 0) i = 0;
- while (data.suggestions[i] != NULL) {
- const char * suggestion = data.suggestions[i++];
- if (strncmp(data.word, suggestion, strlen(data.word)) == 0)
- return strdup(suggestion);
+ while (data.options[i] != NULL) {
+ const char * option = data.options[i++];
+ if (strncmp(data.word, option, strlen(data.word)) == 0)
+ return strdup(option);
}
return NULL;
});