From ebcb198f09cb1615d7c0b6b206b2cdc2124901dd Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 19 Jun 2024 13:04:09 +0200 Subject: [PATCH] Fix statusbar display of active tab When using `/statusbar tabmode actlist` and `/statusbar self user` then we get `[00:23] [user]` and now `[00:23] [1:user]` where `1` is the active tab. The active tab is only displayed with fulljid. This commit fixes 7d290b04d. Fix https://github.com/profanity-im/profanity/issues/1980 --- src/ui/statusbar.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 20c4a1131..164babca9 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -549,37 +549,20 @@ _status_bar_draw_maintext(int pos) return pos; } - if (statusbar->fulljid) { - jidp = jid_create(statusbar->fulljid); - if (g_strcmp0(self, "user") == 0) { - maintext = jidp->localpart; - } else if (g_strcmp0(self, "barejid") == 0) { - maintext = jidp->barejid; - } else { - maintext = statusbar->fulljid; - } - } - - if (maintext == NULL) { + if (statusbar->fulljid == NULL) { return pos; } - if (statusbar->fulljid) { - if (g_strcmp0(self, "off") == 0) { - return pos; - } - if (g_strcmp0(self, "user") == 0) { - auto_jid Jid* jidp = jid_create(statusbar->fulljid); - mvwprintw(statusbar_win, 0, pos, "%s", jidp->localpart); - return pos; - } - if (g_strcmp0(self, "barejid") == 0) { - auto_jid Jid* jidp = jid_create(statusbar->fulljid); - mvwprintw(statusbar_win, 0, pos, "%s", jidp->barejid); - return pos; - } + jidp = jid_create(statusbar->fulljid); + if (!jidp) + return pos; - mvwprintw(statusbar_win, 0, pos, "%s", statusbar->fulljid); + if (g_strcmp0(self, "user") == 0) { + maintext = jidp->localpart; + } else if (g_strcmp0(self, "barejid") == 0) { + maintext = jidp->barejid; + } else { + maintext = statusbar->fulljid; } gboolean actlist_tabmode = _tabmode_is_actlist();