Remove GNU Readline rl_complete() prototype, for now

We should add a configure option --enable-readline-compat, or sth, so
rl_complete2() (removed in this commit) becomes the new rl_complete(),
and the current rl_complete() becomes el_complete().

The current implementation of rl_complete2() was is incomplete and also
not working properly.  To eliminate any confusion on the matter this
patch removes it.  To restore functionality we should, at the very
least, merge with complete() and possibly also refactor rl_find_token()
to share code with the legacy el_find_word().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2018-09-13 19:06:05 +02:00
parent e962b9582a
commit 9a16999f0e
2 changed files with 0 additions and 61 deletions

View File

@ -114,15 +114,10 @@ extern void add_history (const char *line);
extern int read_history (const char *filename);
extern int write_history (const char *filename);
//extern int rl_complete2 (int ignore, int invoking_key);
extern rl_completion_func_t *rl_attempted_completion_function;
extern rl_complete_func_t *rl_set_complete_func (rl_complete_func_t *func);
extern rl_list_possib_func_t *rl_set_list_possib_func (rl_list_possib_func_t *func);
// TODO: See comment for src/complete.c:rl_complete2()
//#define rl_complete(a, b) _Generic((a), int: rl_complete2, default: rl_complete)(a, b)
/* Alternate interface to plain readline(), for event loops */
extern void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler);
extern void rl_callback_read_char (void);

View File

@ -339,62 +339,6 @@ char **rl_completion_matches(const char *token, rl_compentry_func_t *generator)
return array;
}
//
// TODO: Add configure option --enable-readline-compat, or sth,
// so that rl_complete2() becomes the new rl_complete(),
// and the current rl_complete() becomes el_complete()
//
// Currently rl_complete() to is incomplete (heh ;) and also very
// incorrect. At the very least we should merge with complete()
// and possibly also refacto rl_find_token() to share code with
// the legacy el_find_word().
//
#if 0
/*
* Implements the actual FSF readline rl_complete() API
*
* "isolates the word to be completed and calls rl_completion_matches()
* to generate a list of possible completions"
*/
int rl_complete2(int ignore, int invoking_key)
{
char *token, *word, **words = NULL;
size_t len;
token = rl_find_token(&len);
if (!token)
return 0; /* Nothing inserted */
word = strndup(token, len);
rl_attempted_completion_over = 0;
if (rl_attempted_completion_function) {
int start = token - rl_line_buffer;
int end = start + len;
words = rl_attempted_completion_function(word, start, end);
}
if (!rl_attempted_completion_over && !words)
words = rl_completion_matches(word, NULL);
if (words && words[0]) {
int i = 1;
free(word);
word = words[0];
while (words[i])
free(words[i++]);
free(words);
return word;
}
return el_filename_complete(word, match);
}
#endif // Disabled atm.
static char *complete(char *token, int *match)
{
size_t len = 0;