Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zstyle is badly broken as of 20060817
- X-seq: zsh-workers 22650
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx, pws@xxxxxxxxxxxxxxxxx
- Subject: Re: zstyle is badly broken as of 20060817
- Date: Sun, 20 Aug 2006 22:38:24 +0100
- In-reply-to: Message from Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> of "Sun, 20 Aug 2006 13:44:19 PDT." <060820134419.ZM4072@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> Also now there's no way to get the style back again:
>
> schaefer<501> zstyle ":completion:*:default" list-prompt ''
> schaefer<502> zstyle | grep list-prompt
> list-prompt
> schaefer<503> zstyle -d ":completion:*:default" list-prompt
> schaefer<504> zstyle | grep list-prompt
> schaefer<505> zstyle ":completion:*:default" list-prompt "Go On"
> schaefer<506> zstyle | grep list-prompt
> schaefer<507> echo $?
> 1
> schaefer<508>
Deleting styles had a bad effect because there's a zlstyles variable
which always points to the last variable added, so that new styles are
added there. This doesn't work so well if you can remove styles. I've
just removed zlstyles. If an optimisation is really necessary a better
one would be to hash the styles. This fixed the symptom in my case.
I haven't looked at the effect of list-prompt after being removed. I
probably won't get a chance for some weeks. Anyone else is welcome to
look at anything.
Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.19
diff -u -r1.19 zutil.c
--- Src/Modules/zutil.c 20 Aug 2006 17:04:58 -0000 1.19
+++ Src/Modules/zutil.c 20 Aug 2006 21:36:56 -0000
@@ -54,7 +54,7 @@
/* List of styles. */
-static Style zstyles, zlstyles;
+static Style zstyles;
/* Memory stuff. */
@@ -117,7 +117,7 @@
zsfree(s->name);
zfree(s, sizeof(*s));
}
- zstyles = zlstyles = NULL;
+ zstyles = NULL;
}
/* Get the style struct for a name. */
@@ -233,11 +233,8 @@
s->pats = NULL;
s->name = ztrdup(name);
- if (zlstyles)
- zlstyles->next = s;
- else
- zstyles = s;
- zlstyles = s;
+ s->next = zstyles;
+ zstyles = s;
return s;
}
@@ -1748,7 +1745,7 @@
int
setup_(UNUSED(Module m))
{
- zstyles = zlstyles = NULL;
+ zstyles = NULL;
return 0;
}
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author