* Re: Completion in braces and accept-and-menu-complete
@ 1999-01-27 12:53 Sven Wischnowsky
1999-02-05 8:31 ` zsh-3.1.5-pws-6: " Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-01-27 12:53 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> I had /tools/lib/zsh/zsh-3.1.4
> zsh-3.1.5
> zsh-3.1.5-pws-5
> libzsh-3.1.4.so
>
> I did
>
> rm -rf /tools/lib/zsh/{z<TAB>
>
> and correctly got listing. Unfotunately, when I pressed ESC-ENTER (bound to
> accept-and-menu-complete) I got
>
> rm -rf /tools/lib/zsh/{zsh-3.1.4 /tools/lib/zsh/{zsh-3.1.5
>
> obviously, not what I had in mind.
Good point.
Bye
Sven
--- os/Zle/zle_tricky.c Wed Jan 27 13:44:28 1999
+++ Src/Zle/zle_tricky.c Wed Jan 27 13:48:56 1999
@@ -98,10 +98,12 @@
/* This is for completion inside a brace expansion. brbeg and brend hold *
* strings that were temporarily removed from the string to complete. *
- * brpl and brsl hold the offset of these strings. */
+ * brpl and brsl hold the offset of these strings. *
+ * brpcs and brscs hold the positions of the re-inserted string in the *
+ * line. */
static char *brbeg = NULL, *brend = NULL;
-static int brpl, brsl;
+static int brpl, brsl, brpcs, brscs;
/* The list of matches. fmatches contains the matches we first ignore *
* because of fignore. */
@@ -426,19 +428,30 @@
void
acceptandmenucomplete(void)
{
- int sl = suffixlen[' '];
-
if (!menucmp) {
feep();
return;
}
- cs = menupos + menulen + menuinsc;
- if (sl)
- backdel(sl);
- inststrlen(" ", 1, 1);
- menuinsc = menulen = 0;
- menupos = cs;
- menuwe = 1;
+ if (brbeg && *brbeg) {
+ int l = (brscs >= 0 ? brscs : cs) - brpcs;
+
+ zsfree(brbeg);
+ brbeg = (char *) zalloc(l + 2);
+ memcpy(brbeg, line + brpcs, l);
+ brbeg[l] = ',';
+ brbeg[l + 1] = '\0';
+ } else {
+ int sl = suffixlen[' '];
+
+ cs = menupos + menulen + menuinsc;
+ if (sl)
+ backdel(sl);
+
+ inststrlen(" ", 1, 1);
+ menuinsc = menulen = 0;
+ menupos = cs;
+ menuwe = 1;
+ }
menucomplete();
}
@@ -2364,6 +2377,7 @@
if (brbeg && *brbeg) {
cs = a + m->brpl + (m->pre ? strlen(m->pre) : 0);
l = strlen(brbeg);
+ brpcs = cs;
inststrlen(brbeg, 1, l);
r += l;
ocs += l;
@@ -2376,12 +2390,13 @@
if (brend && *brend) {
a = cs;
cs -= m->brsl;
- ocs = cs;
+ ocs = brscs = cs;
l = strlen(brend);
inststrlen(brend, 1, l);
r += l;
cs = a + l;
- }
+ } else
+ brscs = -1;
if (m->suf) {
inststrlen(m->suf, 1, (l = strlen(m->suf)));
r += l;
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* zsh-3.1.5-pws-6: RE: Completion in braces and accept-and-menu-complete
1999-01-27 12:53 Completion in braces and accept-and-menu-complete Sven Wischnowsky
@ 1999-02-05 8:31 ` Andrej Borsenkow
0 siblings, 0 replies; 4+ messages in thread
From: Andrej Borsenkow @ 1999-02-05 8:31 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
Thanks, Sven! The only question is, is it possible to make final comma to be
autoremoved? Currently I get
rm glib{-1.1.so.12,-1.1.so.12.0.0,
and if I press '}', the final comma remains.
TIA
/andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: zsh-3.1.5-pws-6: RE: Completion in braces and accept-and-menu-complete
1999-02-05 9:59 Sven Wischnowsky
@ 1999-02-05 10:55 ` Andrej Borsenkow
0 siblings, 0 replies; 4+ messages in thread
From: Andrej Borsenkow @ 1999-02-05 10:55 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
> > autoremoved? Currently I get
> >
> > rm glib{-1.1.so.12,-1.1.so.12.0.0,
> >
> > and if I press '}', the final comma remains.
>
> Have you `setopt autoparamkeys'? Should be on by default and do what
> you want. If this does not solve the problem, I need some more
> information, as this works for me.
>
Now this is really strange. I did have autoparamkey on and it works now. I
can not reproduce it any more (the same shell session).
Sorry for false alarm. I'll keep a look if it happens again.
/andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: zsh-3.1.5-pws-6: RE: Completion in braces and accept-and-menu-complete
@ 1999-02-05 9:59 Sven Wischnowsky
1999-02-05 10:55 ` Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-02-05 9:59 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> Thanks, Sven! The only question is, is it possible to make final comma to be
> autoremoved? Currently I get
>
> rm glib{-1.1.so.12,-1.1.so.12.0.0,
>
> and if I press '}', the final comma remains.
Have you `setopt autoparamkeys'? Should be on by default and do what
you want. If this does not solve the problem, I need some more
information, as this works for me.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-02-05 10:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-27 12:53 Completion in braces and accept-and-menu-complete Sven Wischnowsky
1999-02-05 8:31 ` zsh-3.1.5-pws-6: " Andrej Borsenkow
1999-02-05 9:59 Sven Wischnowsky
1999-02-05 10:55 ` Andrej Borsenkow
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).