Add support for inhibiting completion: rl_inhibit_completion

This commit is contained in:
Joachim Nilsson 2010-08-11 13:14:32 +02:00
parent f984a48dae
commit 87e69be38b
3 changed files with 15 additions and 4 deletions

2
TODO
View File

@ -23,8 +23,6 @@ optional configure flags.
* Add support for rl_bind_key(), currently only en editline specific el_bind_key() exists.
* Add support for inhibiting completion: rl_inhibit_completion
* Make "char *rl_prompt" globally visible.
* Add support for rl_set_prompt().

View File

@ -53,6 +53,7 @@ extern int rl_list_possib(char *token, char ***av);
extern int rl_point;
extern int rl_mark;
extern int rl_end;
extern int rl_inhibit_complete;
extern char *rl_line_buffer;
extern const char *rl_readline_name;
extern FILE *rl_instream; /* The stdio stream from which input is read. Defaults to stdin if NULL - Not supported yet! */

View File

@ -116,6 +116,7 @@ int rl_point;
int rl_mark;
int rl_end;
int rl_meta_chars = 0; /* Display 8-bit chars as the actual char(0) or as `M-x'(1)? */
int rl_inhibit_complete = 0;
char *rl_line_buffer;
const char *rl_prompt;
const char *rl_readline_name; /* Set by calling program, for conditional parsing of ~/.inputrc - Not supported yet! */
@ -904,7 +905,15 @@ static el_status_t emacs(int c)
if (kp->Key == c)
break;
}
s = kp->Function ? kp->Function() : insert_char(c);
if (kp->Function) {
s = kp->Function();
if (s == CSdispatch) /* If Function is inhibited. */
s = insert_char(c);
} else {
s = insert_char(c);
}
if (!el_pushed) {
/* No pushback means no repeat count; hacky, but true. */
Repeat = NO_ARG;
@ -1314,7 +1323,10 @@ static el_status_t c_complete(void)
char *word, *new;
size_t len;
int unique;
el_status_t s = 0;
el_status_t s = CSdone;
if (rl_inhibit_complete)
return CSdispatch;
word = el_find_word();
p = (char *)rl_complete((char *)word, &unique);