From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14664 invoked from network); 9 Oct 1998 11:43:38 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Oct 1998 11:43:37 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id HAA09901; Fri, 9 Oct 1998 07:34:39 -0400 (EDT) Resent-Date: Fri, 9 Oct 1998 07:34:39 -0400 (EDT) Message-Id: <9810091125.AA12690@ibmth.df.unipi.it> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: PATCH: 3.1.4: (alternative) neg-argument fix Date: Fri, 09 Oct 1998 13:25:11 +0200 From: Peter Stephenson Resent-Message-ID: <"US4wP3.0.eQ2.EJV7s"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4420 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu There was a patch from Bart back in zsh-workers/4268 to fix a problem with neg-argument (\e- in emacs mode), namely \e-\e1 gave you 11 instead of 1 and so on. Now I come to look at this, I can't get it to work, i.e. neg-argument won't function at all. I can't think of anything that might be clashing with the patch, thought it's not impossible. However, even if I've done something silly there is the following point: \e- on its own should act as an argument -1 even if no further digit is typed. It's only when you get back to digitargument() for a new digit, if any, that you need to know whether an existing -1 should be treated as a real -1 (e.g you already typed \e-\e1) or not (you've only just typed \e-). I couldn't see a way of doing this without adding a new flag, though that doesn't mean there isn't one. This therefore is my alternative version of 4268. Is there any enthusiasm for upgrading universal-argument to do what emacs does, that is to take any following digits as part of the argument? *** Src/Zle/zle.h.mult Thu Jul 9 13:27:28 1998 --- Src/Zle/zle.h Fri Oct 9 11:28:26 1998 *************** *** 90,95 **** --- 90,96 ---- #define MOD_TMULT (1<<1) /* a repeat count is being entered */ #define MOD_VIBUF (1<<2) /* a vi cut buffer has been selected */ #define MOD_VIAPP (1<<3) /* appending to the vi cut buffer */ + #define MOD_NEG (1<<4) /* last command was negate argument */ /* current modifier status */ *** Src/Zle/zle_misc.c.mult Thu Jul 9 12:04:41 1998 --- Src/Zle/zle_misc.c Fri Oct 9 11:28:38 1998 *************** *** 442,448 **** if (!(zmod.flags & MOD_TMULT)) zmod.tmult = 0; ! zmod.tmult = zmod.tmult * 10 + sign * (c & 0xf); zmod.flags |= MOD_TMULT; prefixflag = 1; } --- 442,454 ---- if (!(zmod.flags & MOD_TMULT)) zmod.tmult = 0; ! if (zmod.flags & MOD_NEG) { ! /* If we just had a negative argument, this is the digit, * ! * rather than the -1 assumed by negargument() */ ! zmod.tmult = sign * (c & 0xf); ! zmod.flags &= ~MOD_NEG; ! } else ! zmod.tmult = zmod.tmult * 10 + sign * (c & 0xf); zmod.flags |= MOD_TMULT; prefixflag = 1; } *************** *** 456,462 **** return; } zmod.tmult = -1; ! zmod.flags |= MOD_TMULT; prefixflag = 1; } --- 462,468 ---- return; } zmod.tmult = -1; ! zmod.flags |= MOD_TMULT|MOD_NEG; prefixflag = 1; } -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy