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

PATCH: fix 3, was Re: unpatch: metafying zle line



Two more:

which-command and run-help were broken because I forgot to copy the code
that moves the cursor to the end, so the strings were inserted in the
wrong order.

Some more advanced menu features including accept-and-menu-complete were
broken by yet another complication with the metafication state when
using menus.

Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.55
diff -u -r1.55 compresult.c
--- Src/Zle/compresult.c	10 Aug 2005 10:56:41 -0000	1.55
+++ Src/Zle/compresult.c	10 Aug 2005 19:44:28 -0000
@@ -687,6 +687,8 @@
 mod_export int
 hasbrpsfx(Cmatch m, char *pre, char *suf)
 {
+    METACHECK();
+
     if (m->flags & CMF_ALL)
 	return 1;
     else {
@@ -1153,6 +1155,15 @@
 mod_export void
 do_menucmp(int lst)
 {
+    int was_meta;
+
+    /* Already metafied when called from domenuselect already */
+    if (zlemetaline == NULL) {
+	was_meta = 0;
+	metafy_line();
+    } else
+	was_meta = 1;
+
     /* Just list the matches if the list was requested. */
     if (lst == COMP_LIST_COMPLETE) {
 	showinglist = -2;
@@ -1173,13 +1184,10 @@
 	     (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
 	      (!(*minfo.cur)->str || !*(*minfo.cur)->str)));
     /* ... and insert it into the command line. */
-    /* Already metafied when called from domenuselect already */
-    if (zlemetaline == NULL) {
-	metafy_line();
-	do_single(*minfo.cur);
+    do_single(*minfo.cur);
+
+    if (!was_meta)
 	unmetafy_line();
-    } else
-	do_single(*minfo.cur);
 }
 
 /**/
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.54
diff -u -r1.54 zle_tricky.c
--- Src/Zle/zle_tricky.c	10 Aug 2005 10:56:41 -0000	1.54
+++ Src/Zle/zle_tricky.c	10 Aug 2005 19:44:51 -0000
@@ -1800,6 +1800,8 @@
 	ZS_strncpy(zleline + zlecs, zlestr, zlelen);
 	free(zlestr);
 	zsfree((char *)instr);
+	if (move)
+	    zlecs += len;
     }
     return len;
 }

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



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