From dd2b19ec42e72d4fdc540774a9899dd526f4d0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 28 Dec 2021 13:52:58 +0100 Subject: [PATCH] core: fix display of hotlist in buflist after changing value of option weechat.look.hotlist_sort (closes #1733) The "hotlist" pointer in buffers was lost, it is now set again after switching to the newly sorted hotlist. --- ChangeLog.adoc | 1 + src/gui/gui-hotlist.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 006d5bda1..486f59196 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -24,6 +24,7 @@ New features:: Bug fixes:: + * core: fix display of hotlist in buflist after changing value of option weechat.look.hotlist_sort (issue #1733) * irc: fix display of IRC numeric messages with no parameters Tests:: diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index 2de62215c..5aee49333 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -166,7 +166,7 @@ gui_hotlist_free_all (struct t_gui_hotlist **hotlist, /* remove all hotlists */ while (*hotlist) { - gui_hotlist_free (hotlist, last_hotlist, *hotlist, 1); + gui_hotlist_free (hotlist, last_hotlist, *hotlist, 0); } } @@ -504,11 +504,20 @@ gui_hotlist_resort () gui_hotlist_add_hotlist (&new_hotlist, &last_new_hotlist, element); } + /* clear whole hotlist */ gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist); + /* switch to new sorted hotlist */ gui_hotlist = new_hotlist; last_gui_hotlist = last_new_hotlist; + /* reassign hotlist in buffers */ + for (ptr_hotlist = gui_hotlist; ptr_hotlist; + ptr_hotlist = ptr_hotlist->next_hotlist) + { + ptr_hotlist->buffer->hotlist = ptr_hotlist; + } + gui_hotlist_changed_signal (NULL); }