diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-15 18:44:58 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-15 18:44:58 +0000 |
commit | 39f9073586b6dc72efd43fc4d0884c8335e86f96 (patch) | |
tree | d3599ffa739d9c6eb98e18a4f3dc3a80f9db070c /src | |
parent | 5563a8f2030455c2ce4b85582ef27034180be38e (diff) | |
download | irssi-39f9073586b6dc72efd43fc4d0884c8335e86f96.zip |
Right-aligned statusbar items weren't positioned correctly.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2021 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-text/statusbar.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index d31f5b8c..fa90672a 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -235,7 +235,7 @@ static void statusbar_resize_items(STATUSBAR_REC *bar, int max_width) static void statusbar_calc_item_positions(STATUSBAR_REC *bar) { WINDOW_REC *old_active_win; - GSList *tmp; + GSList *tmp, *right_items; int xpos, rxpos; old_active_win = active_win; @@ -266,26 +266,33 @@ static void statusbar_calc_item_positions(STATUSBAR_REC *bar) } } - /* right-aligned items */ - rxpos = term_width; + /* right-aligned items - first copy them to a new list backwards, + easier to draw them in right order */ + right_items = NULL; for (tmp = bar->items; tmp != NULL; tmp = tmp->next) { SBAR_ITEM_REC *rec = tmp->data; - if (rec->config->right_alignment && rec->size > 0) { - if (SBAR_ITEM_REDRAW_NEEDED(bar, rec, xpos)) { - rec->dirty = TRUE; - if (bar->dirty_xpos == -1 || - xpos < bar->dirty_xpos) { - irssi_set_dirty(); - bar->dirty = TRUE; - bar->dirty_xpos = xpos; - } - rec->xpos = rxpos; - } + if (rec->config->right_alignment && rec->size > 0) + right_items = g_slist_prepend(right_items, rec); + } - rxpos -= rec->size; + rxpos = term_width; + for (tmp = right_items; tmp != NULL; tmp = tmp->next) { + SBAR_ITEM_REC *rec = tmp->data; + + rxpos -= rec->size; + if (SBAR_ITEM_REDRAW_NEEDED(bar, rec, rxpos)) { + rec->dirty = TRUE; + if (bar->dirty_xpos == -1 || + rxpos < bar->dirty_xpos) { + irssi_set_dirty(); + bar->dirty = TRUE; + bar->dirty_xpos = rxpos; + } + rec->xpos = rxpos; } } + g_slist_free(right_items); active_win = old_active_win; } |