From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id GAA13090 for ; Fri, 24 May 1996 06:25:15 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id QAA05761; Thu, 23 May 1996 16:13:32 -0400 (EDT) Resent-Date: Thu, 23 May 1996 16:13:32 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199605232013.WAA04943@bolyai.cs.elte.hu> Subject: Re: fix for completing to NULs To: A.Main@dcs.warwick.ac.uk (Zefram) Date: Thu, 23 May 1996 22:13:30 +0200 (MET DST) Cc: zsh-workers@math.gatech.edu In-Reply-To: <19843.199605231452@stone.dcs.warwick.ac.uk> from Zefram at "May 23, 96 03:52:48 pm" Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"qOnhh.0.xP1.hRCfn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1159 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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. */