From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id CAA10928 for ; Thu, 16 Nov 1995 02:48:54 +1100 (EST) Received: by math.gatech.edu (5.x/SMI-SVR4) id AA21370; Wed, 15 Nov 1995 10:34:32 -0500 Resent-Date: Wed, 15 Nov 1995 16:32:17 +0100 Old-Return-Path: Message-Id: <9511151532.AA00841@sgi.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Alias fix Date: Wed, 15 Nov 1995 16:32:17 +0100 From: Peter William Stephenson Resent-Message-Id: <"NNlOP3.0.nD5.7YWgm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/612 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I've wasted the whole day fixing bugs, there's no point doing anything useful now: This fixes this problem I've just reported: % alias foo='echo ' % foo bar bar % -> % foo bar (extra spaces being inserted). The fix is deliberately restrictive so as not to cause knock-on problems. *** Src/hist.c.sp Wed Nov 15 14:29:01 1995 --- Src/hist.c Wed Nov 15 16:29:55 1995 *************** *** 686,691 **** --- 686,701 ---- alstat = 0; } + /* Go back to immediately after the last word, skipping space. */ + + /**/ + void + histbackword(void) + { + if (!(chwordpos%2) && chwordpos) + hptr = chline + chwords[chwordpos-1]; + } + /* Get the start and end point of the current history word */ /**/ *** Src/input.c.sp Wed Nov 15 16:14:35 1995 --- Src/input.c Wed Nov 15 16:22:30 1995 *************** *** 161,169 **** /* a real alias: mark it as unused. */ ix->inuse = 0; t = ix->text; ! if (*t && t[strlen(t) - 1] == ' ') alstat = ALSTAT_MORE; ! else alstat = ALSTAT_JUNK; inalpush(ix); } --- 161,170 ---- /* a real alias: mark it as unused. */ ix->inuse = 0; t = ix->text; ! if (*t && t[strlen(t) - 1] == ' ') { alstat = ALSTAT_MORE; ! histbackword(); ! } else alstat = ALSTAT_JUNK; inalpush(ix); } -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.