Factor out windowReflow

weechat-hashes
C. McEnroe 2021-01-26 19:33:17 -05:00
parent 6cab788e6a
commit 76670b2fb1
1 changed files with 9 additions and 10 deletions

19
ui.c
View File

@ -597,15 +597,18 @@ void uiFormat(
uiWrite(id, heat, time, buf); uiWrite(id, heat, time, buf);
} }
static void windowReflow(struct Window *window) {
window->unreadHard = bufferReflow(
window->buffer, COLS, window->thresh, window->unreadSoft
);
}
static void resize(void) { static void resize(void) {
statusUpdate(); statusUpdate();
wclear(main); wclear(main);
wresize(main, MAIN_LINES, COLS); wresize(main, MAIN_LINES, COLS);
for (uint num = 0; num < windows.len; ++num) { for (uint num = 0; num < windows.len; ++num) {
struct Window *window = windows.ptrs[num]; windowReflow(windows.ptrs[num]);
window->unreadHard = bufferReflow(
window->buffer, COLS, window->thresh, window->unreadSoft
);
} }
windowUpdate(); windowUpdate();
} }
@ -792,9 +795,7 @@ static void incThresh(struct Window *window, int n) {
} else { } else {
window->thresh += n; window->thresh += n;
} }
window->unreadHard = bufferReflow( windowReflow(window);
window->buffer, COLS, window->thresh, window->unreadSoft
);
windowUpdate(); windowUpdate();
statusUpdate(); statusUpdate();
} }
@ -1065,9 +1066,7 @@ void uiLoad(const char *name) {
readString(file, &buf, &cap); readString(file, &buf, &cap);
bufferPush(window->buffer, COLS, window->thresh, heat, time, buf); bufferPush(window->buffer, COLS, window->thresh, heat, time, buf);
} }
window->unreadHard = bufferReflow( windowReflow(window);
window->buffer, COLS, window->thresh, window->unreadSoft
);
} }
urlLoad(file, version); urlLoad(file, version);