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

Re: fix for completing to NULs



Zefram wrote:
> If completing to a string ending in NUL, the completion code thinks
> that the space of the metafied NUL is a suffix, and so puts the
> cursor in the wrong place.  This fixes it.

Partly.  There are some other places where this should be fixed.  The patch
below fixes that.  As a side note, I do not think that anyone ever want to
complete strings with null characters.  Filenames do not have null
characters and it cannot be used in arguments to external commands as well.

Zoltan

 *** Src/zle_tricky.c	1996/05/23 17:14:24	2.38
 --- Src/zle_tricky.c	1996/05/23 20:05:03
 ***************
 *** 5,11 ****
    *
    * This file is part of zsh, the Z shell.
    *
 !  * Copyright (c) 1992-1995 Paul Falstad
    * All rights reserved.
    *
    * Permission is hereby granted, without written agreement and without
 --- 5,11 ----
    *
    * This file is part of zsh, the Z shell.
    *
 !  * Copyright (c) 1992-1996 Paul Falstad
    * All rights reserved.
    *
    * Permission is hereby granted, without written agreement and without
 ***************
 *** 577,583 ****
       noerrs = ne;
       /* When completing between words, the contents *
        * of wb and we may be garbled.                */
 !     if (we > wb && iblank(line[we - 1]) && (we < 2 || line[we - 2] != '\\'))
   	we--;
       /* For vi mode, reset the start-of-insertion pointer to the beginning *
        * of the word being completed, if it is currently later.  Vi itself  *
 --- 577,584 ----
       noerrs = ne;
       /* When completing between words, the contents *
        * of wb and we may be garbled.                */
 !     if (we > wb && iblank(line[we - 1]) && 
 ! 	(we < 2 || (line[we - 2] != '\\' && line[we - 2] != STOUC(Meta))))
   	we--;
       /* For vi mode, reset the start-of-insertion pointer to the beginning *
        * of the word being completed, if it is currently later.  Vi itself  *
 ***************
 *** 1008,1014 ****
   	/* Sometimes the lexer gives us token strings ending with spaces: *
   	 * we delete the spaces.                                          */
   	while (sl && clwords[i][sl - 1] == ' ' &&
 ! 	       (sl < 2 || clwords[i][sl - 2] != Bnull))
   	    clwords[i][--sl] = '\0';
   	/* If this is the word the cursor is in and we added a `x', *
   	 * remove it.                                               */
 --- 1009,1016 ----
   	/* Sometimes the lexer gives us token strings ending with spaces: *
   	 * we delete the spaces.                                          */
   	while (sl && clwords[i][sl - 1] == ' ' &&
 ! 	       (sl < 2 || (clwords[i][sl - 2] != Bnull &&
 ! 			   clwords[i][sl - 2] != Meta)))
   	    clwords[i][--sl] = '\0';
   	/* If this is the word the cursor is in and we added a `x', *
   	 * remove it.                                               */




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