From: Peter Stephenson <pws@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 [thread overview]
Message-ID: <9810091125.AA12690@ibmth.df.unipi.it> (raw)
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@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy
next reply other threads:[~1998-10-09 11:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-09 11:25 Peter Stephenson [this message]
1998-10-09 15:44 ` Bart Schaefer
1998-10-10 16:33 ` PATCH: 3.1.4: universal-argument upgrade Peter Stephenson
1998-10-12 8:37 ` PATCH: 3.1.4: alternative " Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9810091125.AA12690@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).