commit adc3ed8cdf8e3b84f1abf648f20f6419ce428dd2
parent b2c90dca4abcac94cb7584fceb6f01c4470da00c
Author: hhvn <dev@hhvn.uk>
Date: Fri, 24 Dec 2021 22:22:21 +0000
s/hist.c: always draw first message in buffer
Diffstat:
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/hist.c b/src/hist.c
@@ -87,7 +87,8 @@ hist_add(struct HistInfo *histinfo, struct Nick *from,
if (options & HIST_MAIN) {
if (options & HIST_TMP && histinfo == main_buf) {
hist_add(main_buf, from, msg, params, activity, timestamp, HIST_SHOW);
- return NULL;
+ new = NULL;
+ goto ui;
} else if (histinfo != main_buf) {
hist_add(main_buf, from, msg, params, activity, timestamp, HIST_SHOW);
} else {
@@ -109,7 +110,7 @@ hist_add(struct HistInfo *histinfo, struct Nick *from,
if (!histinfo->history) {
histinfo->history = new;
- return new;
+ goto ui;
}
for (i=0, p = histinfo->history; p && p->next; p = p->next, i++);
@@ -122,6 +123,14 @@ hist_add(struct HistInfo *histinfo, struct Nick *from,
new->next->prev = new;
histinfo->history = new;
+ if (options & HIST_LOG) {
+ if (histinfo->server)
+ hist_log(new->raw, new->from, new->timestamp, histinfo->server);
+ else
+ ui_error("HIST_LOG specified, but server is NULL", NULL);
+ }
+
+ui:
/* TODO: this triggers way too often, need to have some sort of delay */
if (selected.history == histinfo) {
if (options & HIST_SELF)
@@ -131,13 +140,6 @@ hist_add(struct HistInfo *histinfo, struct Nick *from,
windows[Win_main].refresh = 1;
}
- if (options & HIST_LOG) {
- if (histinfo->server)
- hist_log(new->raw, new->from, new->timestamp, histinfo->server);
- else
- ui_error("HIST_LOG specified, but server is NULL", NULL);
- }
-
return new;
}