diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-20 16:32:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-20 16:32:24 +0000 |
commit | 7ca7f75f02ff9e27a8d6213d9a633327c5586e4c (patch) | |
tree | 28f8b6462fda59e5d735ed7f2d5813d0b5b64433 | |
parent | e80f3243e68e9a500af149df98e1d00b22442c42 (diff) |
Move the check for whether to force a line wrapper lower down into the tty code
where it has access to the tty width, which is what should have been checked.
-rw-r--r-- | usr.bin/tmux/screen-write.c | 30 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 10 |
2 files changed, 17 insertions, 23 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index f1394d2bee5..57a4012d6c3 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.33 2009/10/17 08:35:38 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.34 2009/10/20 16:32:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -855,15 +855,15 @@ screen_write_mousemode(struct screen_write_ctx *ctx, int state) s->mode &= ~MODE_MOUSE; } -/* - * Line feed the screen only (don't update the tty). Used for printing single - * characters, where might want to let the scroll happen naturally. - */ +/* Line feed. */ void -screen_write_linefeedscreen(struct screen_write_ctx *ctx, int wrapped) +screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) { struct screen *s = ctx->s; struct grid_line *gl; + struct tty_ctx ttyctx; + + screen_write_initctx(ctx, &ttyctx, 0); gl = &s->grid->linedata[s->grid->hsize + s->cy]; if (wrapped) @@ -875,18 +875,8 @@ screen_write_linefeedscreen(struct screen_write_ctx *ctx, int wrapped) grid_view_scroll_region_up(s->grid, s->rupper, s->rlower); else if (s->cy < screen_size_y(s) - 1) s->cy++; -} - -/* Line feed (down with scroll). */ -void -screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) -{ - struct tty_ctx ttyctx; - - screen_write_initctx(ctx, &ttyctx, 0); - - screen_write_linefeedscreen(ctx, wrapped); + ttyctx.num = wrapped; tty_write(tty_cmd_linefeed, &ttyctx); } @@ -985,7 +975,6 @@ screen_write_cell( struct screen_write_ctx *ctx, const struct grid_cell *gc, u_char *udata) { struct screen *s = ctx->s; - struct window_pane *wp = ctx->wp; struct grid *gd = s->grid; struct tty_ctx ttyctx; struct grid_utf8 gu, *tmp_gu; @@ -1062,10 +1051,7 @@ screen_write_cell( * leave the cursor to scroll naturally, unless this is only * part of the screen width. */ - if (wp->xoff != 0 || wp->sx != screen_size_x(s)) - screen_write_linefeed(ctx, 1); - else - screen_write_linefeedscreen(ctx, 1); + screen_write_linefeed(ctx, 1); s->cx = 0; /* carriage return */ } diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 6ca31f74080..d2d1490adb6 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.51 2009/10/17 08:35:38 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.52 2009/10/20 16:32:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -713,6 +713,14 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) return; } + /* + * If this line wrapped naturally (ctx->num is nonzero), don't do + * anything - the cursor can just be moved to the last cell and wrap + * naturally. + */ + if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP)) + return; + if (ctx->ocy == ctx->orlower) { tty_reset(tty); |