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

PATCH: tiny zle_tricky cleanup



I was looking at how the completion code could be made more modular,
callable from normal widgets again. And then I noticed that we don't
use qword anymore. No need to build it then...


Bye
  Sven

P.S.: No haven't really got anywhere yet. It's entirely non-trivial --
      and see my next patch.

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.38
diff -u -r1.38 zle_tricky.c
--- Src/Zle/zle_tricky.c	1 Jul 2002 08:25:17 -0000	1.38
+++ Src/Zle/zle_tricky.c	8 Jul 2002 09:01:07 -0000
@@ -104,10 +104,6 @@
 /**/
 mod_export int showagain = 0;
 
-/* This holds the word we are completing in quoted from. */
-
-static char *qword;
-
 /* This holds the word we are working on without braces removed. */
 
 static char *origword;
@@ -596,7 +592,6 @@
     } else
 	ol = NULL;
     inwhat = IN_NOTHING;
-    qword = NULL;
     zsfree(qipre);
     qipre = ztrdup("");
     zsfree(qisuf);
@@ -629,7 +624,6 @@
 	    popheap();
 	    unmetafy_line();
 	    zsfree(s);
-	    zsfree(qword);
 	    active = 0;
 	    return 1;
 	}
@@ -814,7 +808,6 @@
     /* Reset the lexer state, pop the heap. */
     lexrestore();
     popheap();
-    zsfree(qword);
     unmetafy_line();
 
     dat[0] = lst;
@@ -1391,7 +1384,6 @@
 	parse_subst_string(s);
     }
     /* This variable will hold the current word in quoted form. */
-    qword = ztrdup(s);
     offs = cs - wb;
     if ((p = parambeg(s))) {
 	for (p = s; *p; p++)
@@ -1434,7 +1426,7 @@
         }
     }
     /* While building the quoted form, we also clean up the command line. */
-    for (p = s, tt = qword, i = wb, j = 0; *p; p++, tt++, i++)
+    for (p = s, i = wb, j = 0; *p; p++, i++)
 	if (INULL(*p)) {
 	    if (i < cs)
 		offs--;
@@ -1442,21 +1434,18 @@
 		j = 1-j;
 	    if (p[1] || *p != Bnull) {
 		if (*p == Bnull) {
-		    *tt = '\\';
 		    if (cs == i + 1)
 			cs++, offs++;
 		} else {
 		    ocs = cs;
 		    cs = i;
 		    foredel(1);
-		    chuck(tt--);
 		    if ((cs = ocs) > i--)
 			cs--;
 		    we--;
 		}
 	    } else {
 		ocs = cs;
-		*tt = '\0';
 		cs = we;
 		backdel(1);
 		if (ocs == we)

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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