summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 09:36:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-21 09:36:54 +0000
commit2558245728f3e25bcca834aa8b74952f1bcc911c (patch)
tree3cdc6711fd4e0bdf5e3dd649e54a288532b6112a /usr.bin/tmux/tty.c
parent60687b0548f29c9642a9610f4269ef1f70d74572 (diff)
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.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 0f7bd1f2683..a0bc4e2882b 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.54 2009/10/20 19:18:28 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.55 2009/10/21 09:36:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -955,6 +955,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;