* 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.
This commit is contained in:
Gunnar Ritter
2005-02-15 22:39:33 +00:00
parent 280906a241
commit 1dbb3c2a66
6 changed files with 37 additions and 17 deletions

View File

@@ -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;
}