1
0
Fork 0
forked from murx/irc9

Separate channel topics from chat with an accent divider

This commit is contained in:
Johannes Findeisen 2026-11-29 00:26:27 +01:00
commit 9c7390bad8

16
irc9.c
View file

@ -2474,7 +2474,7 @@ static void draw_title(void)
fputs("\033[0m", stdout); fputs("\033[0m", stdout);
} }
/* Use the same topic height for drawing and paging the chat pane. */ /* Include the topic divider when calculating the chat pane height. */
static int layout_topic(int draw) static int layout_topic(int draw)
{ {
int width = cols - treew - (copy_view ? 0 : 2); int width = cols - treew - (copy_view ? 0 : 2);
@ -2488,14 +2488,22 @@ static int layout_topic(int draw)
int count = 0; int count = 0;
push_wrapped(rows, &count, MAXWRAPROWS, topic, width); push_wrapped(rows, &count, MAXWRAPROWS, topic, width);
int limit = mainh > 1 ? mainh - 1 : 1; int divider = mainh >= 3;
int limit = mainh > 1 ? mainh - 1 - divider : 1;
int left = treew + (copy_view ? 0 : 1);
int height = count < limit ? count : limit; int height = count < limit ? count : limit;
for (int row = 0; row < count; row++) { for (int row = 0; row < count; row++) {
char *text = rows[count - 1 - row]; char *text = rows[count - 1 - row];
if (draw && row < height) draw_irc_text(row + 1, treew + (copy_view ? 0 : 1), text, width); if (draw && row < height) draw_irc_text(row + 1, left, text, width);
free(text); free(text);
} }
return height; if (draw && divider) {
terminal_move(height + 1, left);
terminal_accent();
terminal_repeat('-', width);
fputs("\033[0m", stdout);
}
return height + divider;
} }
static void draw_main(void) static void draw_main(void)