* vi-replace-chars compatibility fix
@ 1996-11-29 21:45 Zefram
0 siblings, 0 replies; only message in thread
From: Zefram @ 1996-11-29 21:45 UTC (permalink / raw)
To: Z Shell workers mailing list
-----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-----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-11-29 21:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-29 21:45 vi-replace-chars compatibility fix Zefram
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).