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

Re: experimental new style completion



Here is another little fixlet for the new style completion stuff. The
tokenizing in comp_str() failed for `$'s. Not wanting to change
tokenize() itself I added a little wrapper function in zle_tricky.c
(is there really no better way?).

Bye
 Sven

*** Src/Zle/zle_tricky.c.old	Thu Jan 21 12:59:33 1999
--- Src/Zle/zle_tricky.c	Thu Jan 21 12:58:27 1999
***************
*** 3348,3353 ****
--- 3348,3379 ----
      return 1;
  }
  
+ /* This should probably be moved into tokenize(). */
+ 
+ static char *
+ ctokenize(char *p)
+ {
+     char *r = p;
+     int bslash = 0;
+ 
+     tokenize(p);
+ 
+     for (p = r; *p; p++) {
+ 	if (*p == '\\')
+ 	    bslash = 1;
+ 	else {
+ 	    if (*p == '$') {
+ 		if (bslash)
+ 		    p[-1] = Bnull;
+ 		else
+ 		    *p = String;
+ 	    }
+ 	    bslash = 0;
+ 	}
+     }
+     return r;
+ }
+ 
  /**/
  char *
  comp_str(int *ipl, int *pl)
***************
*** 3358,3368 ****
      char *str;
      int lp, ls, lip;
  
!     tokenize(p);
      remnulargs(p);
!     tokenize(s);
      remnulargs(s);
!     tokenize(ip);
      remnulargs(ip);
      ls = strlen(s);
      lip = strlen(ip);
--- 3384,3394 ----
      char *str;
      int lp, ls, lip;
  
!     ctokenize(p);
      remnulargs(p);
!     ctokenize(s);
      remnulargs(s);
!     ctokenize(ip);
      remnulargs(ip);
      ls = strlen(s);
      lip = strlen(ip);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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