zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re:  Completion in braces and accept-and-menu-complete
Date: Wed, 27 Jan 1999 13:53:00 +0100 (MET)	[thread overview]
Message-ID: <199901271253.NAA31999@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Wed, 27 Jan 1999 12:57:34 +0300


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


             reply	other threads:[~1999-01-27 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-27 12:53 Sven Wischnowsky [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199901271253.NAA31999@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).