summaryrefslogtreecommitdiff
path: root/src/fe-text/statusbar-items.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text/statusbar-items.c')
-rw-r--r--src/fe-text/statusbar-items.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 044c2fa0..de4499b4 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -143,16 +143,34 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
static void item_act(SBAR_ITEM_REC *item, int get_size_only)
{
char *actlist;
+ int max_size;
+
+ if (get_size_only) {
+ if (activity_list == NULL)
+ item->min_size = item->max_size = 0;
+ /* Skip activity calculation on regular trigger, only
+ set dirty */
+ return;
+ }
actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE);
if (actlist == NULL) {
- if (get_size_only)
- item->min_size = item->max_size = 0;
return;
}
- statusbar_item_default_handler(item, get_size_only,
+ max_size = item->max_size;
+ statusbar_item_default_handler(item, TRUE,
+ NULL, actlist, FALSE);
+ statusbar_item_default_handler(item, FALSE,
NULL, actlist, FALSE);
+ if (max_size != item->max_size) {
+ /* Due to above hack of skipping the calculation, we
+ need to manually trigger the redraw process now or
+ we won't see the item */
+ item->bar->dirty = item->dirty = TRUE;
+ statusbar_redraw(item->bar, TRUE);
+ statusbar_redraw_dirty();
+ }
g_free_not_null(actlist);
}
@@ -289,6 +307,10 @@ static void sig_statusbar_more_updated(void)
{
int visible;
+ /* no active window, for example during /window hide */
+ if (active_win == NULL)
+ return;
+
visible = g_slist_find(more_visible, WINDOW_MAIN(active_win)) != NULL;
if (WINDOW_GUI(active_win)->view->more_text != visible)
statusbar_items_redraw("more");
@@ -347,10 +369,14 @@ static void item_lag(SBAR_ITEM_REC *item, int get_size_only)
last_lag_unknown = lag_unknown;
if (lag_unknown) {
- g_snprintf(str, sizeof(str), "%d (?""?)", lag/100);
+ // "??)" in C becomes ']'
+ // See: https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C
+ g_snprintf(str, sizeof(str), "%d (?""?)", lag / 100);
} else {
- g_snprintf(str, sizeof(str),
- lag%100 == 0 ? "%d" : "%d.%02d", lag/100, lag%100);
+ if (lag % 100 == 0)
+ g_snprintf(str, sizeof(str), "%d", lag / 100);
+ else
+ g_snprintf(str, sizeof(str), "%d.%02d", lag / 100, lag % 100);
}
statusbar_item_default_handler(item, get_size_only,