From 7bc8be006eb45af0f5fc1fa6dc79b638d2d1b66f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 18 Jan 2009 21:35:09 +0000 Subject: [PATCH] A couple of trivial optimisations. --- tty.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tty.c b/tty.c index 73a7e020..7bc0dcee 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.59 2009-01-18 12:09:42 nicm Exp $ */ +/* $Id: tty.c,v 1.60 2009-01-18 21:35:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -317,7 +317,8 @@ tty_putc(struct tty *tty, char ch) ch = tty_get_acs(tty, ch); buffer_write8(tty->out, ch); - tty->cx++; /* This is right most of the time. */ + if (ch >= 0x20) + tty->cx++; /* This is right most of the time. */ if (tty->log_fd != -1) write(tty->log_fd, &ch, 1); @@ -521,7 +522,6 @@ tty_cmd_reverseindex( tty_cursor(tty, s->cx, s->cy, oy); tty_putcode(tty, TTYC_RI); - } void @@ -740,7 +740,10 @@ tty_region(struct tty *tty, struct screen *s, u_int oy) void tty_cursor(struct tty *tty, u_int cx, u_int cy, u_int oy) { - if (tty->cx != cx || tty->cy != oy + cy) { + if (cx == 0 && tty->cx != 0 && tty->cy == oy + cy) { + tty->cx = 0; + tty_putc(tty, '\r'); + } else if (tty->cx != cx || tty->cy != oy + cy) { tty->cx = cx; tty->cy = oy + cy; tty_putcode2(tty, TTYC_CUP, tty->cy, tty->cx);