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

Re: completing in the middle of the command line causes coredump



"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@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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