From 6b5d023516032e6bc7a6b2e47ae09d158c4a9b63 Mon Sep 17 00:00:00 2001 From: Gunnar Ritter Date: Sun, 2 Jan 2005 14:58:49 +0000 Subject: [PATCH] * Fixed an old vi bug: If a vi command that yanked or deleted part of a line was followed by an ex command that also yanked or deleted some text, a following 'p' vi command pasted the text affected by the former vi command. It now pastes the text of the last yank or delete even if that was an ex command. --- Changes | 5 +++++ ex_cmds.c | 4 +++- ex_proto.h | 3 ++- ex_re.c | 11 ++--------- ex_vops.c | 12 +++++++++++- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index 069764b..807aebf 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,11 @@ Release ... other than xterm. * Handle character case conversions with the '~' vi command correctly if the length of the converted multibyte sequence is smaller than the original one. +* Fixed an old vi bug: If a vi command that yanked or deleted part of a line + was followed by an ex command that also yanked or deleted some text, a + following 'p' vi command pasted the text affected by the former vi command. + It now pastes the text of the last yank or delete even if that was an ex + command. Release 12/2/04 * Support for multibyte character locales was added. diff --git a/ex_cmds.c b/ex_cmds.c index f489512..c7491a5 100644 --- a/ex_cmds.c +++ b/ex_cmds.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_cmds.c 1.17 (gritter) 11/27/04"; +static char sccsid[] = "@(#)ex_cmds.c 1.18 (gritter) 1/2/05"; #endif #endif @@ -330,6 +330,7 @@ changdir: YANKreg(c); delete(0); appendnone(); + vkillDEL(); continue; /* edit */ @@ -817,6 +818,7 @@ wq: YANKreg(c); else yank(0); + vkillDEL(); continue; /* z */ diff --git a/ex_proto.h b/ex_proto.h index e9bd0c7..c9a7580 100644 --- a/ex_proto.h +++ b/ex_proto.h @@ -70,7 +70,7 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * @(#)ex_proto.h 1.24 (gritter) 12/1/04 + * @(#)ex_proto.h 1.25 (gritter) 1/2/05 */ /* @@ -475,6 +475,7 @@ extern void vshift(int); extern void vrep(register int); extern void vyankit(int); extern void setpk(void); +extern void vkillDEL(void); /* ex_vops2.c */ extern void bleep(register int, char *); extern int vdcMID(void); diff --git a/ex_re.c b/ex_re.c index 3e499a5..381ce5b 100644 --- a/ex_re.c +++ b/ex_re.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_re.c 1.42 (gritter) 12/1/04"; +static char sccsid[] = "@(#)ex_re.c 1.43 (gritter) 1/2/05"; #endif #endif @@ -517,15 +517,8 @@ confirmed(line *a) return (1); pofix(); pline(lineno(a)); - if (inopen) { -#ifndef BIT8 + if (inopen) putchar('\n' | QUOTE); -#else - if (Putchar == listchar) - putchar('$'); - putchar('\n'); -#endif - } c = column(loc1 - 1); ugo(c - 1 + (inopen ? 1 : 0), ' '); ugo(column(loc2 - 1) - c, '^'); diff --git a/ex_vops.c b/ex_vops.c index 9302c4b..adaf4eb 100644 --- a/ex_vops.c +++ b/ex_vops.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_vops.c 1.21 (gritter) 11/29/04"; +static char sccsid[] = "@(#)ex_vops.c 1.22 (gritter) 1/2/05"; #endif #endif @@ -1051,3 +1051,13 @@ setpk(void) pkill[1] = wcursor; } } + +/* + * Kill the last deleted part of a line so that "p" does not put it back. + * This is to be called from ex commands that delete some text. + */ +void +vkillDEL(void) +{ + DEL[0] = 0; +}