Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: 3.1.4: (alternative) neg-argument fix
- X-seq: zsh-workers 4420
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: 3.1.4: (alternative) neg-argument fix
- Date: Fri, 09 Oct 1998 13:25:11 +0200
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 <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author