From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: vi-replace-chars compatibility fix
Date: Fri, 29 Nov 1996 21:45:39 +0000 (GMT) [thread overview]
Message-ID: <10208.199611292145@stone.dcs.warwick.ac.uk> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
This patch modifies the behaviour of vi-replace-chars to really match the
vi behaviour. The comment above the function explains the issue involved.
-zefram
Index: Src/zle_vi.c
===================================================================
RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_vi.c,v
retrieving revision 1.19
diff -c -r1.19 zle_vi.c
*** Src/zle_vi.c 1996/11/25 23:55:04 1.19
--- Src/zle_vi.c 1996/11/29 00:44:01
***************
*** 448,460 ****
/* vi-replace-chars has some oddities relating to vi-repeat-change. In *
* the real vi, if one does 3r at the end of a line, it feeps without *
! * reading the argument. A successful rx followed by 3. at the end of *
! * a line (or 3rx followed by . at the end of a line) will obviously *
! * feep after the ., even though it has the argument available. Here *
! * repeating is tied very closely to argument reading, such that we *
! * can't do that. The solution is to just read the argument even if *
! * the command will fail -- not exactly vi compatible, but it is more *
! * consistent (consider dd in an empty file in vi). */
/**/
void
vireplacechars(void)
--- 448,464 ----
/* vi-replace-chars has some oddities relating to vi-repeat-change. In *
* the real vi, if one does 3r at the end of a line, it feeps without *
! * reading the argument, and won't repeat the action. A successful rx *
! * followed by 3. at the end of a line (or 3rx followed by . at the end *
! * of a line) will obviously feep after the ., even though it has the *
! * argument available. Here repeating is tied very closely to argument *
! * reading, so some trickery is needed to emulate this. When repeating *
! * a change, we always read the argument normally, even if the count *
! * was bad. When recording a change for repeating, and a bad count is *
! * given, we squash the repeat buffer to avoid repeating the partial *
! * command; we've lost the previous change, but that can't be avoided *
! * without a rewrite of the repeat code. */
!
/**/
void
vireplacechars(void)
***************
*** 462,475 ****
int ch;
startvichange(1);
! /* get key */
! if((ch = vigetkey()) == -1) {
! vichgflag = 0;
feep();
return;
}
! /* check argument range */
! if (zmult < 0 || zmult + cs > findeol()) {
vichgflag = 0;
feep();
return;
--- 466,489 ----
int ch;
startvichange(1);
! /* check argument range */
! if (zmult < 1 || zmult + cs > findeol()) {
! if(vichgrepeat) {
! int obeep = opts[BEEP];
! opts[BEEP] = 0;
! vigetkey();
! opts[BEEP] = obeep;
! }
! if(vichgflag) {
! free(vichgbuf);
! vichgbuf = NULL;
! vichgflag = 0;
! }
feep();
return;
}
! /* get key */
! if((ch = vigetkey()) == -1) {
vichgflag = 0;
feep();
return;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMp40DHD/+HJTpU/hAQHvjAP/SeQefx9zQKIQujzIeqqVGLMKjDEkRYvw
TUJuZ2g/DRpcUQZH0WSlwqdQPB3EDGbBN5au1qnfA8glcK77u4Xet31Jc/Xpdxkr
pwzllMJRee0vll5XBd9UIudKks2HXc5CVy58ctRtrSRi5Yh/SM6pWGgp2mIj4vdX
XNMOoYHSU8E=
=K3kz
-----END PGP SIGNATURE-----
reply other threads:[~1996-11-29 21:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=10208.199611292145@stone.dcs.warwick.ac.uk \
--to=zefram@dcs.warwick.ac.uk \
--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).