diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 01:22:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 01:22:32 -0700 |
commit | 4bccfab6324c8c8bc8106e65c4aec076f5d121be (patch) | |
tree | e8d801331da867dbfcbb5ee1b1c1bd1b51aaf04d | |
parent | 42d9cb33a555d113897b5decb29c099b4d47a164 (diff) | |
download | uemacs-4bccfab6324c8c8bc8106e65c4aec076f5d121be.tar.gz |
Make 'show_line()' do proper TAB handling
The TAB handling got broken by commit cee00b0efb86 ("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>
-rw-r--r-- | display.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -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; } } |