From 5f79586b4dceb42ba396cf6a8457fd6eb60c91aa Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 8 Nov 2007 11:48:21 -0800 Subject: [PATCH] Add $time_inc to control progress update frequency. I found 250ms to be noticeably different from the old behaviour, and it ruins the rounding of the other _inc variables. --- ChangeLog | 5 +++++ UPDATING | 3 +++ curs_lib.c | 9 +++++---- globals.h | 1 + init.h | 9 +++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 171e1106..4288704a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-11-08 11:26 -0800 Brendan Cully (3869e46f6fd4) + + * color.c, copy.c, imap/command.c: Turn down some debug logging + levels + 2007-11-08 09:03 +0100 Rocco Rutte (92a6bfbed657) * doc/Makefile.am: Add stamp-doc-rc to makedoc-all to build Muttrc diff --git a/UPDATING b/UPDATING index 75ee4681..855eaa89 100644 --- a/UPDATING +++ b/UPDATING @@ -4,6 +4,9 @@ mutt. Please read this file carefully when upgrading your installation. The keys used are: !: modified feature, -: deleted feature, +: new feature + + $time_inc suppresses progress updates less than $time_inc + milliseconds apart. + 1.5.17 (2007-11-01): ! --enable-exact-address works again diff --git a/curs_lib.c b/curs_lib.c index ff1a9431..fe3bf193 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -44,8 +44,6 @@ #include #endif -#define PROGRESS_REFRESH_MILLIS 250 - /* not possible to unget more than one char under some curses libs, and it * is impossible to unget function keys in SLang, so roll our own input * buffering routines. @@ -368,7 +366,9 @@ void mutt_progress_init (progress_t* progress, const char *msg, } if (gettimeofday (&tv, NULL) < 0) dprint (1, (debugfile, "gettimeofday failed: %d\n", errno)); - progress->timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; + /* if timestamp is 0 no time-based suppression is done */ + if (TimeInc) + progress->timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; mutt_progress_update (progress, 0, 0); } @@ -392,7 +392,7 @@ void mutt_progress_update (progress_t* progress, long pos, int percent) /* skip refresh if not enough time has passed */ if (update && progress->timestamp && !gettimeofday (&tv, NULL)) { now = tv.tv_sec * 1000 + tv.tv_usec / 1000; - if (now && now - progress->timestamp < PROGRESS_REFRESH_MILLIS) + if (now && now - progress->timestamp < TimeInc) update = 0; } @@ -402,6 +402,7 @@ void mutt_progress_update (progress_t* progress, long pos, int percent) if (update) { + dprint (1, (debugfile, "Updating progress: %ld\n", pos)); if (progress->flags & M_PROGRESS_SIZE) { pos = pos / (progress->inc << 10) * (progress->inc << 10); diff --git a/globals.h b/globals.h index 15c0d140..eda09870 100644 --- a/globals.h +++ b/globals.h @@ -199,6 +199,7 @@ WHERE short ReadInc; WHERE short SaveHist; WHERE short SendmailWait; WHERE short SleepTime INITVAL (1); +WHERE short TimeInc; WHERE short Timeout; WHERE short Wrap; WHERE short WriteInc; diff --git a/init.h b/init.h index 2b65ddc7..65218102 100644 --- a/init.h +++ b/init.h @@ -2864,6 +2864,15 @@ struct option_t MuttVars[] = { ** When set, the internal-pager will pad blank lines to the bottom of the ** screen with a tilde (~). */ + { "time_inc", DT_NUM, R_NONE, UL &TimeInc, 0 }, + /* + ** .pp + ** Along with ``$read_inc'', ``$write_inc'', and ``$net_inc'', this + ** variable controls the frequency with which progress updates are + ** displayed. It suppresses updates less than ``$time_inc'' milliseconds + ** apart. This can improve throughput on systems with slow terminals, + ** or when running mutt on a remote system. + */ { "timeout", DT_NUM, R_NONE, UL &Timeout, 600 }, /* ** .pp -- 2.40.0