rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 99e9e28b96888db192f93f9afcb4ac9f7e933abf
parent ba06b72d0df0c89e4beddbadedfe42cf4a3088ba
Author: Toby Goodwin <toby@paccrat.org>
Date:   Sat, 18 Apr 2015 12:02:51 +0100

Revert "readline completion: now mainly working" (moved to branch)

This reverts commit 90de423084757db66041175b43a59b5ff630cb50.

Diffstat:
Medit-readline.c | 48------------------------------------------------
1 file changed, 0 insertions(+), 48 deletions(-)

diff --git a/edit-readline.c b/edit-readline.c @@ -14,61 +14,13 @@ struct cookie { char *buffer; }; -/* teach readline how to quote a filename in rc */ -static char *quote(char *text, int type, char *qp) { - char *p, *r; - - /* worst case: string is entirely quote characters each of which will - * be doubled, plus space for initial and final quotes and \0 */ - p = r = malloc(strlen(text) * 2 + 3); - if (!r) return 0; - /* supply opening quote unless already there */ - if (*qp != '\'') - *p++ = '\''; - while (*text) { - if (*text == '\'') - *p++ = '\''; /* double existing quote */ - *p++ = *text++; - } - if (type == SINGLE_MATCH) - *p++ = '\''; - *p = '\0'; - return r; -} - -char *unquote(char *text, int unused) { - char *p, *r; - - p = r = malloc(strlen(text) + 1); - if (!r) return 0; - while (*text) { - *p++ = *text++; - if (*(text - 1) == '\'' && *text == '\'') ++text; - } - *p = '\0'; - return r; -} -static char **complete(const char *text, int start, int end) { - //fprintf(stderr, "completer called on %s with %d and %d", text, start, end); - /* we can look at rl_line_buffer to see whether to complete as a - * command or a filename (should we do variables too?). for now, assume - * it's a filename */ - /* it's a filename: let readline do it's default thing */ - return 0; -} - void *edit_begin(int fd) { List *hist; struct cookie *c; rl_catch_signals = 0; rl_completer_quote_characters = "'"; - rl_basic_word_break_characters = " \t\n`@$><=;|&{("; - rl_basic_quote_characters = ""; rl_filename_quote_characters = "\t\n !#$&'()*;<=>?@[\\]^`{|}~"; - rl_filename_quoting_function = quote; - rl_filename_dequoting_function = unquote; - rl_attempted_completion_function = complete; hist = varlookup("history"); if (hist != NULL)