Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: accept-and-menu-complete in braces and suffixes



Andrej Borsenkow wrote:

> This is with zsh -f:
> 
> itsrm2% l {Commands/ESC-RETURN
> Commands/  Core/
> itsrm2% l {Commands/,Core/
> Commands/  Core/
> 
> The slash is removed if I type anything but not with
> accept-and-menu-complete.

Not with anything, but with a comma and a brace, so a-a-m-c should do
the same, right.

`iremovesuffix()' has a new argument now, saying if the list of
matches should be kept.

Bye
 Sven

diff -u os/Zle/zle.h Src/Zle/zle.h
--- os/Zle/zle.h	Tue Mar  9 15:56:55 1999
+++ Src/Zle/zle.h	Tue Mar  9 16:39:11 1999
@@ -125,7 +125,7 @@
 
 /* Standard type of suffix removal. */
 
-#define removesuffix() iremovesuffix(256)
+#define removesuffix() iremovesuffix(256, 0)
 
 /* Cut/kill buffer type.  The buffer itself is purely binary data, *
  * not NUL-terminated.  len is a length count.  flags uses the     *
diff -u os/Zle/zle_misc.c Src/Zle/zle_misc.c
--- os/Zle/zle_misc.c	Tue Mar  9 15:56:55 1999
+++ Src/Zle/zle_misc.c	Tue Mar  9 16:39:27 1999
@@ -42,7 +42,7 @@
     int neg = zmult < 0;             /* insert *after* the cursor? */
     int m = neg ? -zmult : zmult;    /* number of copies to insert */
 
-    iremovesuffix(c1);
+    iremovesuffix(c1, 0);
     invalidatelist();
 
     if(insmode)
@@ -849,7 +849,7 @@
 
 /**/
 void
-iremovesuffix(int c)
+iremovesuffix(int c, int keep)
 {
     if (suffixfunc) {
 	List l = getshfunc(suffixfunc);
@@ -876,7 +876,8 @@
 	int sl = suffixlen[c];
 	if(sl) {
 	    backdel(sl);
-	    invalidatelist();
+	    if (!keep)
+		invalidatelist();
 	}
     }
     fixsuffix();
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Mar  9 15:56:56 1999
+++ Src/Zle/zle_tricky.c	Tue Mar  9 16:39:40 1999
@@ -463,7 +463,11 @@
 	return;
     }
     if (brbeg && *brbeg) {
-	int l = (brscs >= 0 ? brscs : cs) - brpcs;
+	int l;
+
+	iremovesuffix(',', 1);
+
+	l = (brscs >= 0 ? brscs : cs) - brpcs;
 
 	zsfree(brbeg);
 	brbeg = (char *) zalloc(l + 2);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author