zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: completing in the middle of the command line causes coredump
Date: Mon, 21 Apr 2008 11:11:07 +0100	[thread overview]
Message-ID: <200804211011.m3LAB7BA015539@news01.csr.com> (raw)
In-Reply-To: <a06001004c43214de24b1@kba.biglobe.ne.jp>

"Jun T." wrote:
> zsh (the latest CVS) coredumps while completing in the middle of the command 
> line.
> 
> zleline is NULL because the command line is metafied.

Yes, I wasn't careful enough with the tests.  We need to delay the
checks until we get back to an unmetafied command line.

I've been dreaming about a proper interface between completion and the
rest of the shell, most particularly the main line editor so we can trap
inserts, deletions and replacements properly.

Index: Src/Zle/zle_utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_utils.c,v
retrieving revision 1.50
diff -u -r1.50 zle_utils.c
--- Src/Zle/zle_utils.c	20 Apr 2008 21:25:28 -0000	1.50
+++ Src/Zle/zle_utils.c	21 Apr 2008 10:08:58 -0000
@@ -591,6 +591,7 @@
 {
     int i;
 
+    UNMETACHECK();
     if (flags & CUT_RAW) {
 	i = (zlecs -= ct);
     } else {
@@ -611,6 +612,7 @@
 {
     int i = zlecs;
 
+    UNMETACHECK();
     if (!(flags & CUT_RAW)) {
 	int n = ct;
 	while (n--)
@@ -633,6 +635,7 @@
 	    shiftchars(zlemetacs -= ct, ct);
 	} else {
 	    shiftchars(zlecs -= ct, ct);
+	    CCRIGHT();
 	}
     } else {
 	int n = ct, origcs = zlecs;
@@ -640,8 +643,8 @@
 	while (n--)
 	    DECCS();
 	shiftchars(zlecs, origcs - zlecs);
+	CCRIGHT();
     }
-    CCRIGHT();
 }
 
 /**/
@@ -653,6 +656,7 @@
 	    shiftchars(zlemetacs, ct);
 	} else if (flags & CUT_RAW) {
 	    shiftchars(zlecs, ct);
+	    CCRIGHT();
 	}
     } else {
 	int origcs = zlecs;
@@ -663,8 +667,8 @@
 	ct = zlecs - origcs;
 	zlecs = origcs;
 	shiftchars(zlecs, ct);
+	CCRIGHT();
     }
-    CCRIGHT();
 }
 
 /**/
@@ -672,7 +676,8 @@
 setline(char *s, int flags)
 {
     char *scp;
-	
+
+    UNMETACHECK();
     if (flags & ZSL_COPY)
 	scp = ztrdup(s);
     else


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


      reply	other threads:[~2008-04-21 10:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21  9:56 Jun T.
2008-04-21 10:11 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804211011.m3LAB7BA015539@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).