Add slash corners to the chat pane borders

This commit is contained in:
Johannes Findeisen 2026-11-29 07:52:35 +01:00
commit 886aaec1e3
2 changed files with 14 additions and 7 deletions

View file

@ -110,7 +110,7 @@ Build yours by copying `irc9rc-example` to `irc9rc` next to the binary (or to
``` ```
[irc9] irc.example / #general [irc9] irc.example / #general
/----------------------\---------------------------------------- /----------------------\/--------------------------------------\
|*irc.example | General discussion |*irc.example | General discussion
| |---------------------------------------- | |----------------------------------------
| |-#general | | |-#general |
@ -118,7 +118,7 @@ Build yours by copying `irc9rc-example` to `irc9rc` next to the binary (or to
| \-alice | [10:21] <alice> hello there | \-alice | [10:21] <alice> hello there
|*irc.other | [10:22] <bob> hi |*irc.other | [10:22] <bob> hi
| | [10:22] * alice!u@host joined #help | | [10:22] * alice!u@host joined #help
\______________________/---------------------------------------- \______________________/\--------------------------------------/
[10:23] (me@irc.example:6697 [TLS]) [10:23] (me@irc.example:6697 [TLS])
> your message here > your message here
``` ```

17
irc9.c
View file

@ -2555,12 +2555,19 @@ static void draw_title(void)
fputs("\033[0m", stdout); fputs("\033[0m", stdout);
} }
static void draw_pane_divider(int row) static void draw_pane_divider(int row, int opening, int closing)
{ {
int left = lines > 5 && treew >= 2 ? treew : 0; int left = lines > 5 && treew >= 2 ? treew : 0;
terminal_move(row, left); terminal_move(row, left);
terminal_accent(); terminal_accent();
terminal_repeat('-', cols - left); int width = cols - left;
if (width > 1) {
putchar(opening);
terminal_repeat('-', width - 2);
putchar(closing);
} else if (width == 1) {
putchar('-');
}
fputs("\033[0m", stdout); fputs("\033[0m", stdout);
} }
@ -2585,7 +2592,7 @@ static int layout_topic(int draw)
if (draw && row < height) draw_irc_text(chat_top + row, left, text, width); if (draw && row < height) draw_irc_text(chat_top + row, left, text, width);
free(text); free(text);
} }
if (draw && divider) draw_pane_divider(chat_top + height); if (draw && divider) draw_pane_divider(chat_top + height, '-', '-');
return height + divider; return height + divider;
} }
@ -2693,9 +2700,9 @@ static void redraw(void)
fputs("\033[?25l\033[0m\033[2J", stdout); fputs("\033[?25l\033[0m\033[2J", stdout);
draw_title(); draw_title();
draw_tree(); draw_tree();
if (chat_top > 1) draw_pane_divider(1); if (chat_top > 1) draw_pane_divider(1, '/', '\\');
draw_main(); draw_main();
if (lines >= 4) draw_pane_divider(lines - 3); if (lines >= 4) draw_pane_divider(lines - 3, '\\', '/');
draw_status(); draw_status();
draw_input(); draw_input();
fputs("\033[?25h", stdout); fputs("\033[?25h", stdout);