From ee173366c51bd611060dd17dde560c5453aeab57 Mon Sep 17 00:00:00 2001 From: ketmar Date: Wed, 30 May 2012 16:33:16 +0300 Subject: [PATCH] slightly better redrawing --- .sterm.rc | 2 +- src/sterm.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.sterm.rc b/.sterm.rc index 75e2d88..1e02314 100644 --- a/.sterm.rc +++ b/.sterm.rc @@ -9,7 +9,7 @@ doubleclicktimeout 300 tripleclicktimeout 600 drawtimeout 20 -maxdrawtimeout 3000 # 100..60000, milliseconds +maxdrawtimeout 1500 # 100..60000, milliseconds fastredraw no # don't set this to yes, it actually will SLOWDOWN redraw audiblebell 1 diff --git a/src/sterm.c b/src/sterm.c index 9a7b32e..1221b7c 100644 --- a/src/sterm.c +++ b/src/sterm.c @@ -512,7 +512,7 @@ static int opt_cursorBlink = 0; static int opt_cursorBlinkInactive = 0; static int opt_drawunderline = 1; static int opt_ignoreclose = 0; -static int opt_maxdrawtimeout = 3000; +static int opt_maxdrawtimeout = 1500; static int opt_fastredraw = 0; static int ptrBlanked = 0; static int ptrLastMove = 0; @@ -2678,6 +2678,7 @@ static void tswapscreen (void) { } term->mode ^= MODE_ALTSCREEN; tfulldirt(); + draw(1); } @@ -3148,7 +3149,6 @@ static void csihandle (void) { if (IS_SET(MODE_ALTSCREEN)) { tclearregion(0, 0, term->col-1, term->row-1); tswapscreen(); - term->lastDrawTime = 1; } if (term->escseq.arg[0] != 1049) break; case 1048: @@ -3235,7 +3235,7 @@ static void csihandle (void) { case 1049: /* = 1047 and 1048 */ case 47: case 1047: - if (IS_SET(MODE_ALTSCREEN)) tclearregion(0, 0, term->col-1, term->row-1); else { tswapscreen(); term->lastDrawTime = 1; } + if (IS_SET(MODE_ALTSCREEN)) tclearregion(0, 0, term->col-1, term->row-1); else tswapscreen(); if (term->escseq.arg[0] != 1049) break; case 1048: tcursor(CURSOR_SAVE); @@ -4885,7 +4885,7 @@ static inline int last_draw_too_old (void) { // if (term != NULL) { if (term->dead || !term->wantRedraw) return 0; - return (tt-term->lastDrawTime >= opt_drawtimeout); + return (tt-term->lastDrawTime >= opt_drawtimeout) || (tt-lastDrawTime >= opt_maxdrawtimeout); } return (tt-lastDrawTime >= opt_maxdrawtimeout); } @@ -5666,9 +5666,9 @@ static void cmdScreen (const char *cmdname, char *argstr) { tcmdlinemsgf("screen: %s", (IS_SET(MODE_ALTSCREEN) ? "alt" : "norm")); } else { if (strcasecmp(s, "norm") == 0) { - if (IS_SET(MODE_ALTSCREEN)) { tswapscreen(); term->lastDrawTime = 1; } + if (IS_SET(MODE_ALTSCREEN)) tswapscreen(); } else if (strcasecmp(s, "alt") == 0) { - if (!IS_SET(MODE_ALTSCREEN)) { tswapscreen(); term->lastDrawTime = 1; } + if (!IS_SET(MODE_ALTSCREEN)) tswapscreen(); } } } -- 2.11.4.GIT