Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
vi-replace-chars compatibility fix
- X-seq: zsh-workers 2496
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: vi-replace-chars compatibility fix
- Date: Fri, 29 Nov 1996 21:45:39 +0000 (GMT)
-----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-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author