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

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



Bart Schaefer wrote:

> On May 22,  1:25pm, Sven Wischnowsky wrote:
> } Subject: PATCH: Re: TAB and PS2 and multiline buffers and vared
> }
> } Bart Schaefer wrote:
> } 
> } > 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?
> 
> Yes.  (Well, current at the time I sent the mail.)

I don't understand why it's completing commands then... Hm.

> } > 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.
> 
> Thanks, but as I mentioned in my followup message, compstate[insert]
> seems to have gotten `stuck' somehow, that is, once I'm in this state
> it *always* begins with "tab " so nothing will complete anywhere.  Not
> just inside vared, but after I exit vared and go on to the next PS1.

After having a look at zle_tricky.c again... the patch below should
help when the widget wasn't invoked by TAB, but with TAB, it shouldn't 
have happened before. Did it contain the `tab' on entry to
_main_complete or only on exit?

> } About the missing _message: you have _oldlist in your completer style, 
> } right? Did you try ^X? directly after the TAB?
> 
> Yes, I do have _oldlist, and probably I did try right after the tab.

Then ^X? showed you the list from the TAB, of course, the one without
the _message-string. Maybe we should change _oldlist to not do its job 
when called from _complete_debug. But then again, maybe we shouldn't.


Brute force patch below, but it'll hopefully make sure that we don't
enter docomplete() with an old value in wouldinstab again.

Bye
 Sven

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.10
diff -u -r1.10 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/05/22 11:28:29	1.10
+++ Src/Zle/zle_tricky.c	2000/05/22 14:42:22
@@ -158,7 +158,6 @@
 {
     unsigned char *s = line + cs - 1;
 
-    wouldinstab = 0;
     if (keybuf[0] != '\t' || keybuf[1])
 	return 0;
     for (; s >= line && *s != '\n'; s--)
@@ -192,6 +191,7 @@
 {
     usemenu = !!isset(MENUCOMPLETE);
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     if (c == '\t' && usetab())
 	return selfinsert(args);
     else {
@@ -213,6 +213,7 @@
 {
     usemenu = 1;
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     if (c == '\t' && usetab())
 	return selfinsert(args);
     else
@@ -225,6 +226,7 @@
 {
     usemenu = !!isset(MENUCOMPLETE);
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     return docomplete(COMP_LIST_COMPLETE);
 }
 
@@ -233,6 +235,7 @@
 spellword(char **args)
 {
     usemenu = useglob = 0;
+    wouldinstab = 0;
     return docomplete(COMP_SPELL);
 }
 
@@ -242,6 +245,7 @@
 {
     usemenu = !!isset(MENUCOMPLETE);
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
 
     if (cs != ll) {
 	fixsuffix();
@@ -256,6 +260,7 @@
 expandword(char **args)
 {
     usemenu = useglob = 0;
+    wouldinstab = 0;
     if (c == '\t' && usetab())
 	return selfinsert(args);
     else
@@ -268,6 +273,7 @@
 {
     usemenu = !!isset(MENUCOMPLETE);
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     if (c == '\t' && usetab())
 	return selfinsert(args);
     else {
@@ -289,6 +295,7 @@
 {
     usemenu = 1;
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     if (c == '\t' && usetab())
 	return selfinsert(args);
     else
@@ -301,6 +308,7 @@
 {
     usemenu = !!isset(MENUCOMPLETE);
     useglob = isset(GLOBCOMPLETE);
+    wouldinstab = 0;
     return docomplete(COMP_LIST_EXPAND);
 }
 
@@ -308,6 +316,7 @@
 mod_export int
 reversemenucomplete(char **args)
 {
+    wouldinstab = 0;
     if (!menucmp)
 	return menucomplete(args);
 
@@ -319,6 +328,7 @@
 int
 acceptandmenucomplete(char **args)
 {
+    wouldinstab = 0;
     if (!menucmp)
 	return 1;
     runhookdef(ACCEPTCOMPHOOK, NULL);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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