diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 11:23:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 11:23:32 -0700 |
commit | 1edeced67c1cacefe83444e5fd403dab73529ebf (patch) | |
tree | 57842df35d29fc2281bd8b0eb98b8337204281c7 | |
parent | 0a8b429059b47bca13307967ff0dabf0b79fb1d5 (diff) | |
download | uemacs-1edeced67c1cacefe83444e5fd403dab73529ebf.tar.gz |
Fix vtputc() and simplify show_line by using it again
This re-introduces vtputc() as the way to show characters, which
reinstates the control character handing, and simplifies show_line() in
the process.
vtputc now takes an "int" that is either a unicode character or a signed
char (so negative values in the range [-1, -128] are considered to be
the same as [128, 255]). This allows us to use it regardless of what
the source of data is.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | display.c | 34 |
1 files changed, 10 insertions, 24 deletions
@@ -164,10 +164,17 @@ void vtmove(int row, int col) * This routine only puts printing characters into the virtual * terminal buffers. Only column overflow is checked. */ -static void vtputc(unsigned char c) +static void vtputc(int c) { struct video *vp; /* ptr to line being updated */ + /* In case somebody passes us a signed char.. */ + if (c < 0) { + c += 256; + if (c < 0) + return; + } + vp = vscreen[vtrow]; if (vtcol >= term.t_ncol) { @@ -436,32 +443,11 @@ static int reframe(struct window *wp) static void show_line(struct line *lp) { unsigned i = 0, len = llength(lp); - struct video *vp; - - vp = vscreen[vtrow]; while (i < len) { unicode_t c; - int n; - - if (vtcol >= term.t_ncol) { - vp->v_text[term.t_ncol - 1] = '$'; - 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; + i += utf8_to_unicode(lp->l_text, i, len, &c); + vtputc(c); } } |