From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26815 invoked from network); 9 Jul 1999 13:47:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Jul 1999 13:47:37 -0000 Received: (qmail 28198 invoked by alias); 9 Jul 1999 13:47:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7083 Received: (qmail 28191 invoked from network); 9 Jul 1999 13:47:27 -0000 Date: Fri, 9 Jul 1999 15:47:25 +0200 (MET DST) Message-Id: <199907091347.PAA16687@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Fri, 09 Jul 1999 14:34:00 +0200 Subject: Re: PATCH: completions for su and implicit fg/bg Peter Stephenson wrote: > > It's `compset -q' -- and with that I can repeat the question I asked > > at the time when I sent the completion-quoting-patch: currently the > > `-q' option only has an effect if the word on the command line is > > quoted -- should we change it to work on unquoted strings, too? > > Presumably the answer should be yes, for consistency. I already gave an > example with backslashing where it should be treated that way. This allows `compset -q' on unquoted words -- almost. There is a problem when the match contains characters that have to be quoted. In such cases the match should be quoted twice (`a b' should be inserted as `a\\\ b'), but currently the completion code is far from being prepared for such double-quoting and I'm seeing to much places where changes are needed for a quick patch. I'll take care of that later. Bye Sven diff -u os/Zle/compctl.c Src/Zle/compctl.c --- os/Zle/compctl.c Fri Jul 9 10:56:31 1999 +++ Src/Zle/compctl.c Fri Jul 9 15:41:02 1999 @@ -2096,9 +2096,7 @@ case 'P': test = CVT_PREPAT; break; case 's': test = CVT_SUFNUM; break; case 'S': test = CVT_SUFPAT; break; - case 'q': return !(compquote && *compquote && - (*compquote == '\'' || *compquote == '"') && - !set_comp_sepptr()); + case 'q': return set_comp_sepptr(); default: zerrnam(name, "bad option -%c", NULL, argv[0][1]); return 1; diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Fri Jul 9 10:56:33 1999 +++ Src/Zle/zle_tricky.c Fri Jul 9 15:18:10 1999 @@ -5171,10 +5171,16 @@ zsfree(compisuffix); compisuffix = ztrdup(""); zsfree(compqiprefix); - compqiprefix = qp; zsfree(compqisuffix); - compqisuffix = qs; - + if (instring) { + compqiprefix = qp; + compqisuffix = qs; + } else { + compqiprefix = ztrdup(quotename(qp, NULL)); + zsfree(qp); + compqisuffix = ztrdup(quotename(qs, NULL)); + zsfree(qs); + } freearray(compwords); i = countlinknodes(foo); compwords = (char **) zalloc((i + 1) * sizeof(char *)); diff -u od/Zsh/compwid.yo Doc/Zsh/compwid.yo --- od/Zsh/compwid.yo Fri Jul 9 10:56:41 1999 +++ Doc/Zsh/compwid.yo Fri Jul 9 15:42:36 1999 @@ -620,7 +620,7 @@ testing and modification is performed as if it were not given. ) item(tt(-q))( -If the cursor is currently inside single or double quotes, the word +The word currently being completed is split in separate words at the spaces. The resulting words are stored in the tt(words) array, and tt(PREFIX), tt(SUFFIX), tt(QIPREFIX), and tt(QISUFFIX) are modified to reflect the -- Sven Wischnowsky wischnow@informatik.hu-berlin.de