Fix inserting blank lines BEFORE the new message

master
C. McEnroe 2020-09-02 15:57:36 -04:00
parent 6fe5368ec7
commit a0c8a46c75
1 changed files with 6 additions and 3 deletions

9
ui.c
View File

@ -520,10 +520,12 @@ static void notify(uint id, const char *str) {
void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) { void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
struct Window *window = windows.ptrs[windowFor(id)]; struct Window *window = windows.ptrs[windowFor(id)];
time_t ts = (src ? *src : time(NULL)); time_t ts = (src ? *src : time(NULL));
if (heat < Cold && window->ignore) {
bufferPush(window->buffer, COLS, heat, ts, str);
return;
}
int lines = bufferPush(window->buffer, COLS, heat, ts, str); int lines = 0;
if (heat < Cold && window->ignore) return;
if (!window->unreadSoft++) window->unreadHard = 0; if (!window->unreadSoft++) window->unreadHard = 0;
if (window->mark && heat > Cold) { if (window->mark && heat > Cold) {
if (!window->unreadWarm++) { if (!window->unreadWarm++) {
@ -532,6 +534,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
if (heat > window->heat) window->heat = heat; if (heat > window->heat) window->heat = heat;
statusUpdate(); statusUpdate();
} }
lines += bufferPush(window->buffer, COLS, heat, ts, str);
window->unreadHard += lines; window->unreadHard += lines;
if (window->scroll) windowScroll(window, lines); if (window->scroll) windowScroll(window, lines);
if (window == windows.ptrs[windows.show]) windowUpdate(); if (window == windows.ptrs[windows.show]) windowUpdate();