zsh-workers
 help / color / mirror / code / Atom feed
* Re: Fun with new completion
@ 1999-03-09 14:50 Sven Wischnowsky
  1999-03-09 15:16 ` accept-and-menu-complete in braces and suffixes Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-09 14:50 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> I have /archive/pub/unix/sudo/ with cu-sudo* files in it. I forgot, that
> they are prefixed with cu- and did
> 
> gzcat /a/p/u/s/s<TAB>
> 
> with the nice result
> 
> gzcat //a
> 
> Plain old multicomp just beeps and leaves the string as is. Now, it is
> _really_ hard to decide what to do ... Should it complete as far as
> possible? Or, if nothing matches, leave command line as is? Again, the
> problem is, zsh cannot read your mind and decide, where was the error.

At least it shouldn't give what it gives now... this was something
that looked good for the things I tried it with but sometimes...

The patch below makes it leave the line unchanged. A probably better
solution would have a second loop over the `-W' paths to try to expand 
as much of the path as possible. Hm, I /think/ that would be better...

Bye
 Sven

P.S.: The senders in the summary of my mail reader look like a party
      of ping-pong between Andrej and me...

diff -u oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files	Tue Mar  9 15:31:15 1999
+++ Completion/Core/_path_files	Tue Mar  9 15:46:06 1999
@@ -261,9 +261,6 @@
       # next `-W' path.
 
       if [[ $#collect -eq 0 ]]; then
-        compadd -QU "$addpfx[@]" "$addsfx[@]" "$group[@]" "$expl[@]" \
-                -i "$IPREFIX" -p "${linepath:q}${testpath:q}" -S "/${ostr#*/}" \
-		-W "$tmp1" -f "$ignore[@]" - "${(@)tmp1:q}"
         continue 2
       elif [[ $#collect -ne 1 ]]; then
         # If we have more than one possible match, this means that the

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* accept-and-menu-complete in braces and suffixes
  1999-03-09 14:50 Fun with new completion Sven Wischnowsky
@ 1999-03-09 15:16 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-09 15:16 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers


> P.S.: The senders in the summary of my mail reader look like a party
>       of ping-pong between Andrej and me...


It's actually my first day with new completion. So far I just try to get the
same environment I had before (with some additional benefits :-)

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.

cheers

/andrej


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

* Re: accept-and-menu-complete in braces and suffixes
@ 1999-03-09 15:43 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-09 15:43 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


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

end of thread, other threads:[~1999-03-09 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-09 14:50 Fun with new completion Sven Wischnowsky
1999-03-09 15:16 ` accept-and-menu-complete in braces and suffixes Andrej Borsenkow
1999-03-09 15:43 Sven Wischnowsky

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).