commit - 89e4650865dd63b981f91873704f3883ed20aa05
commit + 0e7b2e99bcc7b27a70cab7a553746ca3ed98ccac
blob - 83f4588888e274692672a22226766cde1fe60baf
blob + d8d4d7edf70df62136d77dd6a30f731ab068b9c6
--- ChangeLog
+++ ChangeLog
+2022-05-05 Omar Polo <op@omarpolo.com>
+
+ * ui.c (ui_on_download_refresh): rate-limit the update of the
+ download pane
+
2022-04-24 Omar Polo <op@omarpolo.com>
* session.c (save_session): generate session and histfile atomically
blob - 605da51f8dec8e5d9ea30481d277de1ba61cce50
blob + a7027a900ad35ef00aa79dd94069de4f2190e7fe
--- ui.c
+++ ui.c
static void dispatch_stdio(int, short, void*);
static void handle_resize(int, short, void*);
static void handle_resize_nodelay(int, short, void*);
+static void handle_download_refresh(int, short, void *);
static void rearrange_windows(void);
static void line_prefix_and_text(struct vline *, char *, size_t, const char **, const char **);
static void print_vline(int, int, WINDOW*, struct vline*);
static struct event resizeev;
static struct timeval resize_timer = { 0, 250000 };
+static struct event download_refreshev;
+static struct timeval download_refresh_timer = { 0, 250000 };
+
static WINDOW *tabline, *body, *modeline, *echoarea, *minibuffer;
int body_lines, body_cols;
rearrange_windows();
}
+static void
+handle_download_refresh(int s, short v, void *d)
+{
+ if (side_window & SIDE_WINDOW_BOTTOM) {
+ recompute_downloads();
+ redraw_tab(current_tab);
+ }
+}
+
static inline int
should_show_tab_bar(void)
{
ui_main_loop(void)
{
evtimer_set(&resizeev, handle_resize, NULL);
+ evtimer_set(&download_refreshev, handle_download_refresh, NULL);
event_set(&stdioev, 0, EV_READ | EV_PERSIST, dispatch_stdio, NULL);
event_add(&stdioev, NULL);
void
ui_on_download_refresh(void)
{
- if (side_window & SIDE_WINDOW_BOTTOM) {
- recompute_downloads();
- redraw_tab(current_tab);
- }
+ if (event_pending(&download_refreshev, EV_TIMEOUT, NULL))
+ return;
+
+ evtimer_set(&download_refreshev, handle_download_refresh, NULL);
+ evtimer_add(&download_refreshev, &download_refresh_timer);
}
void