1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-19 07:46:24 -05:00

Make 'show_line()' do proper TAB handling

The TAB handling got broken by commit cee00b0efb ("Show UTF-8 input as
UTF-8 output") when it stopped doing things one byte at a time.

I'm sure the other special character cases are broken too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2012-07-11 01:22:32 -07:00
parent 42d9cb33a5
commit 4bccfab632

View File

@ -442,13 +442,26 @@ static void show_line(struct line *lp)
while (i < len) {
unicode_t c;
int n;
i += utf8_to_unicode(lp->l_text, i, len, &c);
if (vtcol >= term.t_ncol)
if (vtcol >= term.t_ncol) {
vp->v_text[term.t_ncol - 1] = '$';
else if (vtcol >= 0)
vp->v_text[vtcol] = c;
return;
}
n = utf8_to_unicode(lp->l_text, i, len, &c);
/*
* Change tabs into spaces, and don't increment
* the text source until we hit tabmask
*/
++vtcol;
if (c == '\t') {
c = ' ';
if (vtcol & tabmask)
n = 0;
}
if (vtcol > 0)
vp->v_text[vtcol-1] = c;
i += n;
}
}