diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-10-23 17:06:23 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-10-23 17:06:23 +0000 |
commit | ac4e4a2b6c2b0ddef7614a38ed40307dd32bbaf6 (patch) | |
tree | a9e53745bab6e6803363444318cf4fefb27e64fd /tty.c | |
parent | 13d1df659f464714af03221bfe2f1ef680dae3ae (diff) | |
download | rtmux-ac4e4a2b6c2b0ddef7614a38ed40307dd32bbaf6.tar.gz rtmux-ac4e4a2b6c2b0ddef7614a38ed40307dd32bbaf6.tar.bz2 rtmux-ac4e4a2b6c2b0ddef7614a38ed40307dd32bbaf6.zip |
Sync OpenBSD patchset 414:
Instead of having a complicated check to see if the cursor is in the last
position to avoid an explicit wrap, actually move it there.
Some UTF-8 fixes to come.
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.153 2009-10-23 17:03:48 tcunha Exp $ */ +/* $Id: tty.c,v 1.154 2009-10-23 17:06:23 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -461,7 +461,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) /* * Don't move the cursor to the start permission if it will wrap there - * itself; much the same as the conditions in tty_cmd_cell. + * itself. */ gl = NULL; if (py != 0) @@ -847,33 +847,21 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; - struct grid_line *gl; - u_int wx, wy; + u_int cx; tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); - wx = ctx->ocx + wp->xoff; - wy = ctx->ocy + wp->yoff; - /* - * If: - * - * - the line was wrapped: - * - the cursor is beyond the edge of the screen, - * - the desired position is at the left, - * - and either a) the desired next line is the one below the current - * or b) the current line is the bottom of the scroll region, - * - * Then just printing the next character will be enough to scroll into - * place, so don't do an explicit cursor move. + * 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. */ - gl = NULL; - if (ctx->ocy != 0) - gl = &s->grid->linedata[s->grid->hsize + ctx->ocy - 1]; - if (wy == 0 || (gl != NULL && !(gl->flags & GRID_LINE_WRAPPED)) || - tty->cx < tty->sx || /* not at edge of screen */ - wx != 0 || /* don't want 0 next */ - (wy != tty->cy + 1 && tty->cy != ctx->orlower + wp->yoff)) + if (ctx->ocx + wp->xoff > tty->sx - ctx->last_width) { + if (tty->cx < tty->sx) { + 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); + } + } else tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cell(tty, ctx->cell, ctx->utf8); |