aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-10-15 00:01:10 +0100
committerThomas Adam <thomas@xteddy.org>2016-10-15 00:01:10 +0100
commit3d2686a236b4ffee762ada8ebb493d8db91f7375 (patch)
treed2db6c314110ada7cc896449de18f02c2d1ddb01 /tty.c
parent9d58febc8f4243ed4a392e45f89de0455c032090 (diff)
parented971268be7cfd5a4a8223211401654b30a57cbd (diff)
downloadrtmux-3d2686a236b4ffee762ada8ebb493d8db91f7375.tar.gz
rtmux-3d2686a236b4ffee762ada8ebb493d8db91f7375.tar.bz2
rtmux-3d2686a236b4ffee762ada8ebb493d8db91f7375.zip
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tty.c b/tty.c
index 198b8451..34270625 100644
--- a/tty.c
+++ b/tty.c
@@ -424,7 +424,6 @@ void
tty_putc(struct tty *tty, u_char ch)
{
const char *acs;
- u_int sx;
if (tty->cell.attr & GRID_ATTR_CHARSET) {
acs = tty_acs_get(tty, ch);
@@ -436,14 +435,18 @@ tty_putc(struct tty *tty, u_char ch)
bufferevent_write(tty->event, &ch, 1);
if (ch >= 0x20 && ch != 0x7f) {
- sx = tty->sx;
- if (tty->term->flags & TERM_EARLYWRAP)
- sx--;
-
- if (tty->cx >= sx) {
+ if (tty->cx >= tty->sx) {
tty->cx = 1;
if (tty->cy != tty->rlower)
tty->cy++;
+
+ /*
+ * On !xenl terminals, force the cursor position to
+ * where we think it should be after a line wrap - this
+ * means it works on sensible terminals as well.
+ */
+ if (tty->term->flags & TERM_EARLYWRAP)
+ tty_putcode2(tty, TTYC_CUP, tty->cy, tty->cx);
} else
tty->cx++;
}
@@ -1169,8 +1172,9 @@ tty_cell(struct tty *tty, const struct grid_cell *gc,
u_int i;
/* Skip last character if terminal is stupid. */
- if (tty->term->flags & TERM_EARLYWRAP &&
- tty->cy == tty->sy - 1 && tty->cx == tty->sx - 1)
+ if ((tty->term->flags & TERM_EARLYWRAP) &&
+ tty->cy == tty->sy - 1 &&
+ tty->cx == tty->sx - 1)
return;
/* If this is a padding character, do nothing. */