=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.192 retrieving revision 1.193 diff -c -r1.192 -r1.193 *** src/usr.bin/tmux/tty.c 2015/10/31 13:12:03 1.192 --- src/usr.bin/tmux/tty.c 2015/11/13 08:09:28 1.193 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.192 2015/10/31 13:12:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.193 2015/11/13 08:09:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 656,665 **** tty_draw_line(struct tty *tty, const struct window_pane *wp, struct screen *s, u_int py, u_int ox, u_int oy) { ! const struct grid_cell *gc; struct grid_line *gl; - struct grid_cell tmpgc; - struct utf8_data ud; u_int i, sx; int flags; --- 656,663 ---- tty_draw_line(struct tty *tty, const struct window_pane *wp, struct screen *s, u_int py, u_int ox, u_int oy) { ! struct grid_cell gc; struct grid_line *gl; u_int i, sx; int flags; *************** *** 686,703 **** tty_cursor(tty, ox, oy + py); for (i = 0; i < sx; i++) { ! gc = grid_view_peek_cell(s->grid, i, py); if (screen_check_selection(s, i, py)) { ! memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc); ! grid_cell_get(gc, &ud); ! grid_cell_set(&tmpgc, &ud); ! tmpgc.flags = gc->flags & ! ~(GRID_FLAG_FG256|GRID_FLAG_BG256); ! tmpgc.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); ! tty_cell(tty, &tmpgc, wp); ! } else ! tty_cell(tty, gc, wp); } if (sx < tty->sx) { --- 684,696 ---- tty_cursor(tty, ox, oy + py); for (i = 0; i < sx; i++) { ! grid_view_get_cell(s->grid, i, py, &gc); if (screen_check_selection(s, i, py)) { ! gc.flags &= ~(GRID_FLAG_FG256|GRID_FLAG_BG256); ! gc.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); ! } ! tty_cell(tty, &gc, wp); } if (sx < tty->sx) { *************** *** 1078,1084 **** tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); /* Is the cursor in the very last position? */ ! width = grid_cell_width(ctx->cell); if (ctx->ocx > wp->sx - width) { if (ctx->xoff != 0 || wp->sx != tty->sx) { /* --- 1071,1077 ---- tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); /* Is the cursor in the very last position? */ ! width = ctx->cell->data.width; if (ctx->ocx > wp->sx - width) { if (ctx->xoff != 0 || wp->sx != tty->sx) { /* *************** *** 1095,1101 **** * move as far left as possible and redraw the last * cell to move into the last position. */ ! cx = screen_size_x(s) - grid_cell_width(&ctx->last_cell); tty_cursor_pane(tty, ctx, cx, ctx->ocy); tty_cell(tty, &ctx->last_cell, wp); } --- 1088,1094 ---- * move as far left as possible and redraw the last * cell to move into the last position. */ ! cx = screen_size_x(s) - ctx->last_cell.data.width; tty_cursor_pane(tty, ctx, cx, ctx->ocy); tty_cell(tty, &ctx->last_cell, wp); } *************** *** 1155,1162 **** tty_cell(struct tty *tty, const struct grid_cell *gc, const struct window_pane *wp) { ! struct utf8_data ud; ! u_int i; /* Skip last character if terminal is stupid. */ if (tty->term->flags & TERM_EARLYWRAP && --- 1148,1154 ---- tty_cell(struct tty *tty, const struct grid_cell *gc, const struct window_pane *wp) { ! u_int i; /* Skip last character if terminal is stupid. */ if (tty->term->flags & TERM_EARLYWRAP && *************** *** 1171,1193 **** tty_attributes(tty, gc, wp); /* Get the cell and if ASCII write with putc to do ACS translation. */ ! grid_cell_get(gc, &ud); ! if (ud.size == 1) { ! if (*ud.data < 0x20 || *ud.data == 0x7f) return; ! tty_putc(tty, *ud.data); return; } /* If not UTF-8, write _. */ if (!(tty->flags & TTY_UTF8)) { ! for (i = 0; i < ud.width; i++) tty_putc(tty, '_'); return; } /* Write the data. */ ! tty_putn(tty, ud.data, ud.size, ud.width); } void --- 1163,1184 ---- tty_attributes(tty, gc, wp); /* Get the cell and if ASCII write with putc to do ACS translation. */ ! if (gc->data.size == 1) { ! if (*gc->data.data < 0x20 || *gc->data.data == 0x7f) return; ! tty_putc(tty, *gc->data.data); return; } /* If not UTF-8, write _. */ if (!(tty->flags & TTY_UTF8)) { ! for (i = 0; i < gc->data.width; i++) tty_putc(tty, '_'); return; } /* Write the data. */ ! tty_putn(tty, gc->data.data, gc->data.size, gc->data.width); } void