diff --git a/Changes b/Changes index c4dc938..a3b2087 100644 --- a/Changes +++ b/Changes @@ -20,6 +20,12 @@ Release ... * A non-null exit status is now returned if a file could not be opened. * If the match for a substitution is of length zero, a line overflow is now avoided when compiled with the 'UNIX(R) Regular Expression Library'. +* When moving left while the cursor is positioned over a multicolumn + character at the end of the line, the bell is rung now (Bugreport by + Matthew Fischer). +* When moving up or down to a row with different column arrangement while + the cursor is positioned over a multicolumn character, the leftmost + character above the original position is chosen in the new row. Release 1/19/05 * The last release erroneously made 'X' work like 'x' in visual mode. It now diff --git a/ex_proto.h b/ex_proto.h index dca6ff9..6012743 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.26 (gritter) 2/15/05 + * @(#)ex_proto.h 1.27 (gritter) 2/15/05 */ /* @@ -259,6 +259,7 @@ extern int any(int, register char *); extern int backtab(register int); extern void change(void); extern int column(register char *); +extern int lcolumn(register char *); extern void comment(void); extern void Copy(register char *, register char *, register int); extern void copyw(register line *, register line *, register int); diff --git a/ex_put.c b/ex_put.c index ad6a529..08b5e0a 100644 --- a/ex_put.c +++ b/ex_put.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_put.c 1.30 (gritter) 2/15/05"; +static char sccsid[] = "@(#)ex_put.c 1.31 (gritter) 2/15/05"; #endif #endif @@ -745,11 +745,12 @@ dontcr: ((i=vtube[outline][outcol]) < ' ') #else ((i=vtube[outline][outcol]) == 0) - || (i!=MULTICOL && !printable(i&~MULTICOL)) + || (i!=MULTICOL && !printable(i&~INVBIT&~MULTICOL)) #endif ) i = ' '; - if(i & QUOTE) /* mjm: no sign extension on 3B */ + if((i & (QUOTE|INVBIT)) == QUOTE) /* mjm: no sign + extension on 3B */ i = ' '; if ((insmode || i == MULTICOL) && ND) tputs(ND, 0, plodput); diff --git a/ex_subr.c b/ex_subr.c index 11e3374..6f884aa 100644 --- a/ex_subr.c +++ b/ex_subr.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_subr.c 1.36 (gritter) 2/15/05"; +static char sccsid[] = "@(#)ex_subr.c 1.37 (gritter) 2/15/05"; #endif #endif @@ -84,6 +84,8 @@ static char sccsid[] = "@(#)ex_subr.c 1.36 (gritter) 2/15/05"; #include "ex_tty.h" #include "ex_vis.h" +static short lastsc; + /* * Random routines, in alphabetical order. */ @@ -137,6 +139,12 @@ column(register char *cp) return (qcolumn(cp, NULL)); } +int +lcolumn(register char *cp) +{ + return column(cp) - (lastsc - 1); +} + /* * Ignore a comment to the end of the line. * This routine eats the trailing newline so don't call newline(). @@ -659,20 +667,19 @@ qcolumn(register char *lim, register char *gp) int qcount(int c) { - int sc; - if (c == '\t') { vcntcol += value(TABSTOP) - vcntcol % value(TABSTOP); + lastsc = 1; return c; } /* * Take account of filler characters inserted at the end of * the visual line if a multi-column character does not fit. */ - sc = colsc(c); - while (vcntcol < WCOLS && vcntcol + sc - 1 >= WCOLS) + lastsc = colsc(c&TRIM&~MULTICOL); + while (vcntcol < WCOLS && vcntcol + lastsc - 1 >= WCOLS) vcntcol++; - vcntcol += c & MULTICOL ? 1 : sc; + vcntcol += c & MULTICOL ? 1 : lastsc; return c; } diff --git a/ex_voper.c b/ex_voper.c index cd0e29a..d86b5d9 100644 --- a/ex_voper.c +++ b/ex_voper.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_voper.c 1.25 (gritter) 1/19/05"; +static char sccsid[] = "@(#)ex_voper.c 1.27 (gritter) 2/15/05"; #endif #endif @@ -586,7 +586,7 @@ errlab: case CTRL('p'): wdot = dot - cnt; if (vmoving == 0) - vmoving = 1, vmovcol = column(cursor); + vmoving = 1, vmovcol = lcolumn(cursor); wcursor = 0; break; @@ -635,7 +635,7 @@ errlab: case NL: wdot = dot + cnt; if (vmoving == 0) - vmoving = 1, vmovcol = column(cursor); + vmoving = 1, vmovcol = lcolumn(cursor); wcursor = 0; break; @@ -960,7 +960,7 @@ edge(void) if (linebuf[0] == 0) return (1); if (dir == 1) - return (wcursor[1] == 0); + return (wcursor[skipright(linebuf, wcursor)] == 0); else return (wcursor == linebuf); } diff --git a/ex_vput.c b/ex_vput.c index 957c940..f2c9c3f 100644 --- a/ex_vput.c +++ b/ex_vput.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_vput.c 1.48 (gritter) 2/15/05"; +static char sccsid[] = "@(#)ex_vput.c 1.49 (gritter) 2/15/05"; #endif #endif @@ -588,7 +588,7 @@ vinschar(int c) register cell *tp; char *OIM; bool OXN; - int noim; + int noim, filler = 0; insmc1 = colsc(c) - 1; if ((!IM || !EI) && ((hold & HOLDQIK) || !value(REDRAW) || value(SLOWOPEN))) { @@ -747,6 +747,11 @@ vinschar(int c) noim = 0; #ifdef MB if (mb_cur_max > 1) { + if (destcol + 1 + insmc1 == WCOLS + 1) { + noim = 1; + if (insmc1 == 1 && insmc0 == 0) + filler = 1; + } for (i = inscol; vtube0[i]; i++) if (i + 1 >= WCOLS && vtube0[i] & MULTICOL) { noim = 1; @@ -796,7 +801,7 @@ vinschar(int c) * Now put the cursor in its final resting place. */ destline = LINE(vcline); - destcol = inscol + inssiz + insmc1; + destcol = inscol + inssiz + insmc1 + filler; vcsync(); if (IM != OIM) { IM = OIM;