diff --git a/TODO b/TODO index 1b9ffd5..7ea8f1f 100644 --- a/TODO +++ b/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(). diff --git a/include/editline.h b/include/editline.h index ee28d75..7d1afe5 100644 --- a/include/editline.h +++ b/include/editline.h @@ -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! */ diff --git a/src/editline.c b/src/editline.c index 8dc3bb5..98dbe7e 100644 --- a/src/editline.c +++ b/src/editline.c @@ -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);