zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: obscure crash
@ 2006-10-27 11:55 Peter Stephenson
  2006-10-27 11:59 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2006-10-27 11:55 UTC (permalink / raw)
  To: Zsh hackers list

hasbrpsfx() in compresult.c can be called from the display code
when the current completion line is in the wide character form,
but it expects the other form.

This was quite hard to trigger; I had to do accept-and-menu-complete
three times on a non-trivial completion (actually after "p4 revert",
so it's difficult even to set up).  It didn't seem to happen with normal
file completion.

Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.68
diff -u -r1.68 compresult.c
--- Src/Zle/compresult.c	7 Oct 2006 08:05:03 -0000	1.68
+++ Src/Zle/compresult.c	30 Oct 2006 12:52:45 -0000
@@ -683,11 +683,19 @@
 mod_export int
 hasbrpsfx(Cmatch m, char *pre, char *suf)
 {
-    METACHECK();
+    int was_meta;
+
+    /* May not be metafied if calculating whether to show a list. */
+    if (zlemetaline == NULL) {
+	was_meta = 0;
+	metafy_line();
+    } else
+	was_meta = 1;
 
     if (m->flags & CMF_ALL)
 	return 1;
-    else {
+
+    {
 	char *op = lastprebr, *os = lastpostbr;
 	VARARR(char, oline, zlemetall);
 	int oll = zlemetall, ocs = zlemetacs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
@@ -717,6 +725,8 @@
 	lastprebr = op;
 	lastpostbr = os;
 
+	if (!was_meta)
+	    unmetafy_line();
 	return ret;
     }
 }

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


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

* Re: PATCH: obscure crash
  2006-10-27 11:55 PATCH: obscure crash Peter Stephenson
@ 2006-10-27 11:59 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2006-10-27 11:59 UTC (permalink / raw)
  To: Zsh hackers list

Peter Stephenson <pws@csr.com> wrote:
> +    int was_meta;
> +
> +    /* May not be metafied if calculating whether to show a list. */
> +    if (zlemetaline == NULL) {
> +	was_meta = 0;
> +	metafy_line();
> +    } else
> +	was_meta = 1;
>  
>      if (m->flags & CMF_ALL)
>  	return 1;

The ordering here is obviously screwy; I've fixed it in the committed
change.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


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

end of thread, other threads:[~2006-10-30 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-27 11:55 PATCH: obscure crash Peter Stephenson
2006-10-27 11:59 ` Peter Stephenson

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