mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
If redrawing the region would mean redrawing > half the pane, just schedule to
redraw the entire window. Also add a flag to skip updating the window any further if it is scheduled to be redrawn. This has the effect of batching multiple redraws together.
This commit is contained in:
parent
b38f6608c7
commit
84cde92c8f
11
CHANGES
11
CHANGES
@ -1,3 +1,12 @@
|
||||
02 April 2009
|
||||
|
||||
* If redrawing the region would mean redrawing > half the pane, just schedule
|
||||
to redraw the entire window. Also add a flag to skip updating the window any
|
||||
further if it is scheduled to be redrawn. This has the effect of batching
|
||||
multiple redraws together.
|
||||
|
||||
Redraws should be moved to the pane level later.
|
||||
|
||||
01 April 2009
|
||||
|
||||
* Basic horizontal splitting and layout management. Still some redraw and other
|
||||
@ -1185,7 +1194,7 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.268 2009-04-01 18:22:31 nicm Exp $
|
||||
$Id: CHANGES,v 1.269 2009-04-02 20:30:17 nicm Exp $
|
||||
|
||||
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
|
||||
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: server-fn.c,v 1.57 2009-03-07 09:42:13 nicm Exp $ */
|
||||
/* $Id: server-fn.c,v 1.58 2009-04-02 20:30:20 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -146,6 +146,7 @@ server_redraw_window(struct window *w)
|
||||
if (c->session->curw->window == w)
|
||||
server_redraw_client(c);
|
||||
}
|
||||
w->flags |= WINDOW_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
|
4
server.c
4
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.134 2009-04-01 21:10:08 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.135 2009-04-02 20:30:20 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -921,6 +921,8 @@ server_check_window(struct window *w)
|
||||
wp = wq;
|
||||
}
|
||||
|
||||
w->flags &= ~WINDOW_REDRAW; /* redrawn as part of client */
|
||||
|
||||
if (!destroyed)
|
||||
return;
|
||||
|
||||
|
5
tmux.h
5
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.295 2009-04-01 21:10:08 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.296 2009-04-02 20:30:20 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -694,6 +694,7 @@ struct window {
|
||||
#define WINDOW_BELL 0x1
|
||||
#define WINDOW_HIDDEN 0x2
|
||||
#define WINDOW_ACTIVITY 0x4
|
||||
#define WINDOW_REDRAW 0x8
|
||||
|
||||
struct options options;
|
||||
|
||||
@ -1085,7 +1086,7 @@ void tty_set_title(struct tty *, const char *);
|
||||
void tty_update_mode(struct tty *, int);
|
||||
void tty_draw_line(
|
||||
struct tty *, struct screen *, u_int, u_int, u_int);
|
||||
void tty_draw_region(struct tty *, struct screen *, u_int, u_int);
|
||||
void tty_redraw_region(struct tty *, struct window_pane *);
|
||||
int tty_open(struct tty *, char **);
|
||||
void tty_close(struct tty *, int);
|
||||
void tty_free(struct tty *, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tty-write.c,v 1.12 2009-02-21 19:25:58 nicm Exp $ */
|
||||
/* $Id: tty-write.c,v 1.13 2009-04-02 20:30:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -42,6 +42,8 @@ tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap)
|
||||
if (wp == NULL)
|
||||
return;
|
||||
|
||||
if (wp->window->flags & WINDOW_REDRAW)
|
||||
return;
|
||||
if (wp->window->flags & WINDOW_HIDDEN || wp->flags & PANE_HIDDEN)
|
||||
return;
|
||||
|
||||
@ -71,6 +73,8 @@ tty_write_mode(struct window_pane *wp, int mode)
|
||||
if (wp == NULL)
|
||||
return;
|
||||
|
||||
if (wp->window->flags & WINDOW_REDRAW)
|
||||
return;
|
||||
if (wp->window->flags & WINDOW_HIDDEN || wp->flags & PANE_HIDDEN)
|
||||
return;
|
||||
|
||||
|
61
tty.c
61
tty.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tty.c,v 1.90 2009-04-01 18:21:42 nicm Exp $ */
|
||||
/* $Id: tty.c,v 1.91 2009-04-02 20:30:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -379,17 +379,36 @@ tty_emulate_repeat(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Redraw scroll region using data from screen (already updated). Used when
|
||||
* CSR not supported, or window is a pane that doesn't take up the full
|
||||
* width of the terminal.
|
||||
*/
|
||||
void
|
||||
tty_draw_region(struct tty *tty, struct screen *s, u_int ox, u_int oy)
|
||||
tty_redraw_region(struct tty *tty, struct window_pane *wp)
|
||||
{
|
||||
u_int i;
|
||||
struct screen *s = wp->screen;
|
||||
u_int i;
|
||||
|
||||
/*
|
||||
* If region is >= 50% of the screen, just schedule a window redraw. In
|
||||
* most cases, this is likely to be followed by some more scrolling -
|
||||
* without this, the entire pane ends up being redrawn many times which
|
||||
* can be much more data.
|
||||
*
|
||||
* XXX Should just schedule to redraw this pane...
|
||||
*/
|
||||
if (s->old_rupper - s->old_rlower >= screen_size_y(s) / 2) {
|
||||
server_redraw_window(wp->window);
|
||||
return;
|
||||
}
|
||||
|
||||
if (s->old_cy < s->old_rupper || s->old_cy > s->old_rlower) {
|
||||
for (i = s->old_cy; i < screen_size_y(s); i++)
|
||||
tty_draw_line(tty, s, i, ox, oy);
|
||||
tty_draw_line(tty, s, i, wp->xoff, wp->yoff);
|
||||
} else {
|
||||
for (i = s->old_rupper; i <= s->old_rlower; i++)
|
||||
tty_draw_line(tty, s, i, ox, oy);
|
||||
tty_draw_line(tty, s, i, wp->xoff, wp->yoff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,11 +527,7 @@ tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap)
|
||||
|
||||
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
|
||||
!tty_term_has(tty->term, TTYC_CSR)) {
|
||||
/*
|
||||
* Scroll region unsupported. Redraw using data from screen
|
||||
* (already updated).
|
||||
*/
|
||||
tty_draw_region(tty, s, wp->xoff, wp->yoff);
|
||||
tty_redraw_region(tty, wp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -534,11 +549,7 @@ tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap)
|
||||
|
||||
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
|
||||
!tty_term_has(tty->term, TTYC_CSR)) {
|
||||
/*
|
||||
* Scroll region unsupported. Redraw using data from screen
|
||||
* (already updated).
|
||||
*/
|
||||
tty_draw_region(tty, s, wp->xoff, wp->yoff);
|
||||
tty_redraw_region(tty, wp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -612,18 +623,10 @@ void
|
||||
tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap)
|
||||
{
|
||||
struct screen *s = wp->screen;
|
||||
u_int i;
|
||||
|
||||
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
|
||||
!tty_term_has(tty->term, TTYC_CSR)) {
|
||||
/*
|
||||
* Scroll region unsupported. If would have scrolled, redraw
|
||||
* scroll region from already updated window screen.
|
||||
*/
|
||||
if (s->old_cy != s->old_rupper)
|
||||
return;
|
||||
for (i = s->old_rupper; i <= s->old_rlower; i++)
|
||||
tty_draw_line(tty, wp->screen, i, wp->xoff, wp->yoff);
|
||||
tty_redraw_region(tty, wp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -641,18 +644,10 @@ void
|
||||
tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap)
|
||||
{
|
||||
struct screen *s = wp->screen;
|
||||
u_int i;
|
||||
|
||||
if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
|
||||
!tty_term_has(tty->term, TTYC_CSR)) {
|
||||
/*
|
||||
* Scroll region unsupported. If would have scrolled, redraw
|
||||
* scroll region from already updated window screen.
|
||||
*/
|
||||
if (s->old_cy != s->old_rlower)
|
||||
return;
|
||||
for (i = s->old_rupper; i <= s->old_rlower; i++)
|
||||
tty_draw_line(tty, wp->screen, i, wp->xoff, wp->yoff);
|
||||
tty_redraw_region(tty, wp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user