mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 04:21:24 +08:00
Add support for inhibiting completion: rl_inhibit_completion
This commit is contained in:
parent
f984a48dae
commit
87e69be38b
2
TODO
2
TODO
@ -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().
|
||||
|
@ -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! */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user