From 7529db3b731a5b60e4c8e8b6f1e8425a1a4436b2 Mon Sep 17 00:00:00 2001 From: Gunnar Ritter Date: Thu, 13 Jan 2005 19:21:27 +0000 Subject: [PATCH] * Pressing the ^U (kill) character in insert mode sometimes positioned the cursor at weird locations since the last revision (P). --- Changes | 2 ++ ex.h | 5 +++-- ex_subr.c | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 3d25898..4118b1b 100644 --- a/Changes +++ b/Changes @@ -27,6 +27,8 @@ Release ... length of the converted multibyte sequence is smaller than the original one. * Multibyte sequences that correspond to an unprintable character are now printed as multiple octal escape sequences. +* Pressing the ^U (kill) character in insert mode sometimes positioned the + cursor at weird locations since the last revision (P). * 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. diff --git a/ex.h b/ex.h index dc30bc2..664ec23 100644 --- a/ex.h +++ b/ex.h @@ -72,7 +72,7 @@ * * from ex.h 7.7.1.1 (Berkeley) 8/12/86 * - * @(#)ex.h 1.48 (gritter) 12/2/04 + * @(#)ex.h 1.49 (gritter) 1/13/05 */ /* @@ -552,7 +552,8 @@ var int mb_cur_max; #define colsc(c) (mb_cur_max > 1 && ((c)&0177) != (c) ? wcwidth(c) : 1) #define skipleft(l, p) (mb_cur_max > 1 && ((p)[0]&0200 || \ (p)>(l) && (p)[-1]&0200) ? wskipleft(l, p) : -1) -#define skipright(l, p) (mb_cur_max > 1 && (p)[0]&0200 ? wskipright(l, p) : 1) +#define skipright(l, p) (mb_cur_max > 1 && (p)>=(l) && (p)[0]&0200 ? \ + wskipright(l, p) : 1) #define samechar(cp, c) (mb_cur_max > 1 && *(cp)&0200 ? wsamechar(cp, c) : \ (*(cp)&0377) == c) #define xisdigit(c) (mb_cur_max > 1 ? iswdigit(c) : isdigit(c)) diff --git a/ex_subr.c b/ex_subr.c index 480bea0..a72a043 100644 --- a/ex_subr.c +++ b/ex_subr.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_subr.c 1.33 (gritter) 1/12/05"; +static char sccsid[] = "@(#)ex_subr.c 1.34 (gritter) 1/13/05"; #endif #endif @@ -636,7 +636,11 @@ qcolumn(register char *lim, register char *gp) Outchar = qcount; vcntcol = 0; if (lim != NULL) { - n = skipright(linebuf, lim); + if (lim < linebuf) { + lim = linebuf; + n = 0; + } else + n = skipright(linebuf, lim); x = lim[n], lim[n] = 0; } pline(0);