zsh-workers
 help / color / mirror / code / Atom feed
* 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; 3+ 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] 3+ 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; 3+ 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] 3+ messages in thread

* Completion in braces and accept-and-menu-complete
@ 1999-01-27  9:57 Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-01-27  9:57 UTC (permalink / raw)
  To: ZSH workers mailing list

I found it cleaning up old ZSH remnants :-)

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.

Note, that after I enter ',', I can complete again quite nicely.

I am not even sure, if it possible to do right way, but probably, anybody
has an idea?

TIA

/andrej



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-02-05  8:31 UTC | newest]

Thread overview: 3+ 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
  -- strict thread matches above, loose matches on Subject: below --
1999-01-27  9:57 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).