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

PATCH: Re: TAB and PS2 and multiline buffers and vared



Bart Schaefer wrote:

> At either the PS2 prompt or in a multiline buffer, with the new completion
> system enabled, typing TAB beeps and then inserts the tab.
> 
> Why does it beep?

Ahem. Because _main_complete returned one there, I didn't think of the 
beep-effect. That's because I always turn off all beeps.

The return value is probably also the reason for users/3074.

> The situation is different in vared (again with a multiline buffer).
> Sometimes it beeps and then asks me whether I want to see all 2200
> possiblities, other times it just beeps and refuses to insert anything.
> Whether it asks or just beeps seems to depend on whether I started out
> on vared of a value containing newlines (e.g. vared functions[foo] vs.
> vared foo).

Hm. Is that with the current CVS version? We now have the _in_vared
function for completing there and that does assignment-completion
which doesn't complete commands. And it also does its own
tab-insertion handling. And it works for me.

> Sometimes after this happens the completion system gets into a state
> where _complete_debug ceases to function properly.  I type ^X? and the
> debug output goes to the file as expected, but _message doesn't work.
> Also, `?' gets inserted because of compstate[insert]=tab, which is a bit
> strange though not exactly wrong.

The patch also changes it to insert a tab only when TAB was pressed.

About the missing _message: you have _oldlist in your completer style, 
right? Did you try ^X? directly after the TAB?


Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.22
diff -u -r1.22 _main_complete
--- Completion/Core/_main_complete	2000/05/19 16:04:16	1.22
+++ Completion/Core/_main_complete	2000/05/22 11:25:49
@@ -41,7 +41,7 @@
 if [[ "$compstate[insert]" = tab* && "$WIDGET" != *list* ]]; then
   { zstyle -T ":completion:${curcontext}:" insert-tab &&
     { [[ "$curcontext" != :* || -z "$compstate[vared]" ]] ||
-        zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 1
+        zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0
 
   compstate[insert]="${compstate[insert]//tab /}"
 fi
Index: Doc/Zsh/compwid.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compwid.yo,v
retrieving revision 1.14
diff -u -r1.14 compwid.yo
--- Doc/Zsh/compwid.yo	2000/05/17 11:59:32	1.14
+++ Doc/Zsh/compwid.yo	2000/05/22 11:25:50
@@ -314,8 +314,7 @@
 to start menucompletion, beginning with the second match.
 
 Note that a value containing the substring `tt(tab)' makes the
-matches generated be ignored and only the character that was used to
-call the completion widget be inserted.
+matches generated be ignored and only the TAB be inserted.
 
 Finally, it may also be set to tt(all), which makes all matches
 generated be inserted into the line.
Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.22
diff -u -r1.22 compcore.c
--- Src/Zle/compcore.c	2000/05/17 11:59:33	1.22
+++ Src/Zle/compcore.c	2000/05/22 11:25:51
@@ -335,7 +335,7 @@
 	ret = 1;
 	minfo.cur = NULL;
 	if (useline < 0)
-	    selfinsert(zlenoargs);
+	    ret = selfinsert(zlenoargs);
 	goto compend;
     }
     zsfree(lastprebr);
@@ -345,7 +345,7 @@
     if (comppatmatch && *comppatmatch && comppatmatch != opm)
 	haspattern = 1;
     if (useline < 0)
-	selfinsert(zlenoargs);
+	ret = selfinsert(zlenoargs);
     else if (!useline && uselist) {
 	/* All this and the guy only wants to see the list, sigh. */
 	cs = 0;
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.9
diff -u -r1.9 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/05/15 09:54:46	1.9
+++ Src/Zle/zle_tricky.c	2000/05/22 11:25:51
@@ -159,6 +159,8 @@
     unsigned char *s = line + cs - 1;
 
     wouldinstab = 0;
+    if (keybuf[0] != '\t' || keybuf[1])
+	return 0;
     for (; s >= line && *s != '\n'; s--)
 	if (*s != '\t' && *s != ' ')
 	    return 0;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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