aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-23 17:25:51 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-23 17:25:51 +0000
commitdbf2351d3a0505f3b9a9941c99ecb49637096a3f (patch)
tree8cd1bd97cebeb93b1d29257cf4a90d4946f35cd9
parent9731625230c71bfef82e984ad06faede4e816d56 (diff)
downloadrtmux-dbf2351d3a0505f3b9a9941c99ecb49637096a3f.tar.gz
rtmux-dbf2351d3a0505f3b9a9941c99ecb49637096a3f.tar.bz2
rtmux-dbf2351d3a0505f3b9a9941c99ecb49637096a3f.zip
Sync OpenBSD patchset 429:
Now we are correctly not redrawing the whole pane on linefeed, redo the last-cursor-position code to move to the right position when panes reach EOL.
-rw-r--r--tty.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/tty.c b/tty.c
index 028fab69..b04c07c4 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.160 2009-10-23 17:23:52 tcunha Exp $ */
+/* $Id: tty.c,v 1.161 2009-10-23 17:25:51 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -856,17 +856,24 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;
struct screen *s = wp->screen;
- u_int cx;
+ u_int cx, sx;
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- /*
- * Should the cursor be in the last cursor position ready for a natural
- * wrap? If so - and it isn't - move to and rewrite the last cell.
- */
- if (!(tty->term->flags & TERM_EARLYWRAP) &&
- ctx->ocx + wp->xoff > tty->sx - ctx->last_width) {
- if (tty->cx < tty->sx) {
+ /* Is the cursor in the very last position? */
+ if (ctx->ocx > wp->sx - ctx->last_width) {
+ if (wp->xoff != 0 || wp->sx != tty->sx) {
+ /*
+ * The pane doesn't fill the entire line, the linefeed
+ * will already have happened, so just move the cursor.
+ */
+ tty_cursor_pane(tty, ctx, 0, ctx->ocy + 1);
+ } else if (tty->cx < tty->sx) {
+ /*
+ * The cursor isn't in the last position already, so
+ * move as far left as possinble and redraw the last
+ * cell to move into the last position.
+ */
cx = screen_size_x(s) - ctx->last_width;
tty_cursor_pane(tty, ctx, cx, ctx->ocy);
tty_cell(tty, &ctx->last_cell, &ctx->last_utf8);