From 9c7390bad8025fdfe96295b41ccff61153b3362a Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sun, 29 Nov 2026 00:26:27 +0100 Subject: [PATCH] Separate channel topics from chat with an accent divider --- irc9.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/irc9.c b/irc9.c index 50d2953..2733948 100644 --- a/irc9.c +++ b/irc9.c @@ -2474,7 +2474,7 @@ static void draw_title(void) 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) { int width = cols - treew - (copy_view ? 0 : 2); @@ -2488,14 +2488,22 @@ static int layout_topic(int draw) int count = 0; 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; for (int row = 0; row < count; 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); } - 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)