Merge branch '3859_rotate_dash_rate'

* 3859_rotate_dash_rate:
  Ticket #3859: rotating dash generates way too much output.
This commit is contained in:
Andrew Borodin 2019-09-22 13:05:31 +03:00
commit 3195dd7169

View File

@ -50,6 +50,7 @@
#include "lib/strutil.h" #include "lib/strutil.h"
#include "lib/widget.h" #include "lib/widget.h"
#include "lib/event.h" #include "lib/event.h"
#include "lib/util.h" /* mc_time_elapsed() */
#include "src/consaver/cons.saver.h" #include "src/consaver/cons.saver.h"
#include "src/viewer/mcviewer.h" /* The view widget */ #include "src/viewer/mcviewer.h" /* The view widget */
@ -953,11 +954,18 @@ set_hintbar (const char *str)
void void
rotate_dash (gboolean show) rotate_dash (gboolean show)
{ {
static guint64 timestamp = 0;
/* update with 10 FPS rate */
static const guint64 delay = G_USEC_PER_SEC / 10;
const Widget *w = CONST_WIDGET (midnight_dlg); const Widget *w = CONST_WIDGET (midnight_dlg);
if (!nice_rotating_dash || (ok_to_refresh <= 0)) if (!nice_rotating_dash || (ok_to_refresh <= 0))
return; return;
if (show && !mc_time_elapsed (&timestamp, delay))
return;
widget_move (w, (menubar_visible != 0) ? 1 : 0, w->cols - 1); widget_move (w, (menubar_visible != 0) ? 1 : 0, w->cols - 1);
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);