aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-23 17:22:39 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-23 17:22:39 +0000
commit8ec8d1f32ac29915ad1227fe60e264ee4d6a5577 (patch)
treefa5c120bad5b2f64cdf9df24728aee8c5990b75d
parent21b23f8e54fadd2aba369ef4f7ce0c8784168226 (diff)
downloadrtmux-8ec8d1f32ac29915ad1227fe60e264ee4d6a5577.tar.gz
rtmux-8ec8d1f32ac29915ad1227fe60e264ee4d6a5577.tar.bz2
rtmux-8ec8d1f32ac29915ad1227fe60e264ee4d6a5577.zip
Sync OpenBSD patchset 426:
Some terminals don't correctly clear their let's-wrap flag after changing the scroll region (which moves the cursor to 0,0). This means that if the cursor was at the edge of the screen, any further output after scroll region change incorrectly causes a line wrap. Add a workaround to move the cursor to position 0 if it is at the screen edge before changing scroll region.
-rw-r--r--tty.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tty.c b/tty.c
index a6dac18d..c31706f7 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.158 2009-10-23 17:16:24 tcunha Exp $ */
+/* $Id: tty.c,v 1.159 2009-10-23 17:22:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -960,6 +960,15 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower)
tty->rupper = rupper;
tty->rlower = rlower;
+ /*
+ * Some terminals (such as PuTTY) do not correctly reset the cursor to
+ * 0,0 if it is beyond the last column (they do not reset their wrap
+ * flag so further output causes a line feed). As a workaround, do an
+ * explicit move to 0 first.
+ */
+ if (tty->cx >= tty->sx)
+ tty_cursor(tty, 0, tty->cy);
+
tty->cx = 0;
tty->cy = 0;