zsh-workers
 help / color / mirror / code / Atom feed
* fix for completing to NULs
@ 1996-05-23 14:52 Zefram
  1996-05-23 20:13 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Zefram @ 1996-05-23 14:52 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

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.

 -zefram

      Index: Src/zle_tricky.c
      *** zle_tricky.c	1996/05/23 12:31:34	1.18
      --- zle_tricky.c	1996/05/23 13:16:17
      ***************
      *** 3343,3349 ****
        	if (menuend > ll)
        	    menuend = ll;
        	if (menuend && ((((char)line[menuend - 1]) != singlec) ||
      ! 		(menuend > 1 && singlec == ' ' && line[menuend - 2] == '\\')))
        	    if (parampre && singlec == '/' && ((char)line[menuend]) == '/')
        		addedsuffix = 0;
        	    /* Now insert the slash or space if there is none already. */
      --- 3343,3350 ----
        	if (menuend > ll)
        	    menuend = ll;
        	if (menuend && ((((char)line[menuend - 1]) != singlec) ||
      ! 	    (menuend > 1 && singlec == ' ' &&
      ! 	      (line[menuend - 2] == '\\' || line[menuend - 2] == STOUC(Meta)))))
        	    if (parampre && singlec == '/' && ((char)line[menuend]) == '/')
        		addedsuffix = 0;
        	    /* Now insert the slash or space if there is none already. */

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMaRnXXD/+HJTpU/hAQGEnwP/W2rlbWq36yZebaJNWZkEpRvLI45okJOO
FIDu0b2B0rlmqe+1cAr73sk0ZyVQq9YHDEhmkJuItffc0J0MD33rLshTyuUGy1TE
kEQYosHY8/X4M+Ya95Tc+2x9735fXVEjuSG5t1MHVzE6UzkfQAGKCzPnhuMjPXb4
dIuymbc/XPw=
=9+VI
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fix for completing to NULs
  1996-05-23 14:52 fix for completing to NULs Zefram
@ 1996-05-23 20:13 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1996-05-23 20:13 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

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.                                               */



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-23 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-23 14:52 fix for completing to NULs Zefram
1996-05-23 20:13 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).