Sync OpenBSD patchset 366:

Be less aggressive about turning the cursor off, only explicitly turn it off
when tmux is redrawing, otherwise leave in the state set by the application.
This commit is contained in:
Tiago Cunha 2009-10-09 13:03:28 +00:00
parent c2e78a3104
commit 765a38e534

10
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.138 2009-09-23 15:18:56 tcunha Exp $ */ /* $Id: tty.c,v 1.139 2009-10-09 13:03:28 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -533,6 +533,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
const struct grid_utf8 *gu; const struct grid_utf8 *gu;
u_int i, sx; u_int i, sx;
tty_update_mode(tty, tty->mode & ~MODE_CURSOR);
sx = screen_size_x(s); sx = screen_size_x(s);
if (sx > s->grid->linedata[s->grid->hsize + py].cellsize) if (sx > s->grid->linedata[s->grid->hsize + py].cellsize)
sx = s->grid->linedata[s->grid->hsize + py].cellsize; sx = s->grid->linedata[s->grid->hsize + py].cellsize;
@ -557,8 +559,10 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
tty_cell(tty, gc, gu); tty_cell(tty, gc, gu);
} }
if (sx >= tty->sx) if (sx >= tty->sx) {
tty_update_mode(tty, tty->mode);
return; return;
}
tty_reset(tty); tty_reset(tty);
tty_cursor(tty, sx, py, ox, oy); tty_cursor(tty, sx, py, ox, oy);
@ -568,6 +572,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
for (i = sx; i < screen_size_x(s); i++) for (i = sx; i < screen_size_x(s); i++)
tty_putc(tty, ' '); tty_putc(tty, ' ');
} }
tty_update_mode(tty, tty->mode);
} }
void void
@ -596,7 +601,6 @@ tty_write(void (*cmdfn)(
if (c->session->curw->window == wp->window) { if (c->session->curw->window == wp->window) {
if (c->tty.flags & TTY_FREEZE || c->tty.term == NULL) if (c->tty.flags & TTY_FREEZE || c->tty.term == NULL)
continue; continue;
tty_update_mode(&c->tty, c->tty.mode & ~MODE_CURSOR);
cmdfn(&c->tty, ctx); cmdfn(&c->tty, ctx);
} }
} }