hi, (this is a re-post)
make tab completion work for '=', '`', '[', ':', and '$' - pulled from mksh by Alexander Polakov (also posted to tech recently). closes pr 6006 too. comments/ok? Index: edit.c =================================================================== RCS file: /home/okan/hack/open/cvs/src/bin/ksh/edit.c,v retrieving revision 1.34 diff -u -p -r1.34 edit.c --- edit.c 20 May 2010 01:13:07 -0000 1.34 +++ edit.c 14 Mar 2011 09:59:27 -0000 @@ -365,6 +365,11 @@ x_file_glob(int flags, const char *str, continue; } + /* specially escape escaped [ or $ or ` for globbing */ + if (escaping && (toglob[i] == '[' || + toglob[i] == '$' || toglob[i] == '`')) + toglob[idx++] = QCHAR; + toglob[idx] = toglob[i]; idx++; if (escaping) escaping = 0; @@ -378,7 +383,7 @@ x_file_glob(int flags, const char *str, s = pushs(SWSTR, ATEMP); s->start = s->str = toglob; source = s; - if (yylex(ONEWORD) != LWORD) { + if (yylex(ONEWORD|LQCHAR) != LWORD) { source = sold; internal_errorf(0, "fileglob: substitute error"); return 0; @@ -821,7 +826,7 @@ x_escape(const char *s, size_t len, int int rval = 0; for (add = 0, wlen = len; wlen - add > 0; add++) { - if (strchr("\"#$&'()*;<=>?[\\]`{|}", s[add]) || + if (strchr("\"#$&'()*:;<=>?[\\]`{|}", s[add]) || strchr(ifs, s[add])) { if (putbuf_func(s, add) != 0) { rval = -1; Index: lex.c =================================================================== RCS file: /home/okan/hack/open/cvs/src/bin/ksh/lex.c,v retrieving revision 1.45 diff -u -p -r1.45 lex.c --- lex.c 9 Mar 2011 09:30:39 -0000 1.45 +++ lex.c 14 Mar 2011 09:59:27 -0000 @@ -411,6 +411,13 @@ yylex(int cf) } } break; + case QCHAR: + if (cf & LQCHAR) { + *wp++ = QCHAR; + *wp++ = getsc(); + break; + } + /* FALLTHROUGH */ default: *wp++ = CHAR, *wp++ = c; } Index: lex.h =================================================================== RCS file: /home/okan/hack/open/cvs/src/bin/ksh/lex.h,v retrieving revision 1.11 diff -u -p -r1.11 lex.h --- lex.h 29 May 2006 18:22:24 -0000 1.11 +++ lex.h 14 Mar 2011 09:59:27 -0000 @@ -113,6 +113,7 @@ typedef union { #define CMDWORD BIT(8) /* parsing simple command (alias related) */ #define HEREDELIM BIT(9) /* parsing <<,<<- delimiter */ #define HEREDOC BIT(10) /* parsing heredoc */ +#define LQCHAR BIT(11) /* source string contains QCHAR */ #define HERES 10 /* max << in line */