hirc

IRC client
Log | Files | Refs

commit 7fb2cf27e796b51161f04ca8c9680e7d4ab9f279
parent 5183307f4cf92dd1c328ef328f9ba5cb5d9d4184
Author: hhvn <dev@hhvn.uk>
Date:   Fri, 24 Dec 2021 00:11:55 +0000

s/ui.c s/config.c: newlines in ui_format

Diffstat:
Msrc/config.c | 6+++---
Msrc/ui.c | 15+++++++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/config.c b/src/config.c @@ -257,7 +257,7 @@ struct Config config[] = { .description = { "TLS version information", NULL}}, {"format.ui.tls.names", 1, Val_string, - .str = "SNI name: %{b}${2}%{b}\nCert subject: %{b}${3}%{b}\nCert issuer: %{b}${3}%{b}", + .str = "SNI name: %{b}${2}%{b}\\nCert subject: %{b}${3}%{b}\\nCert issuer: %{b}${3}%{b}", .strhandle = config_redraws, .description = { "TLS identification", NULL}}, @@ -443,7 +443,7 @@ struct Config config[] = { .description = { "Format of modes being set on channels", NULL}}, {"format.topic", 1, Val_string, - .str = "topic%{=}\"${2}\" set by %{nick:${nick}}${nick}%{o} now", + .str = "topic%{=}${2}\\nset by %{nick:${nick}}${nick}%{o} now", .strhandle = config_redraws, .description = { "Format of topic being set", NULL}}, @@ -745,7 +745,7 @@ struct Config config[] = { .description = { "Format of RPL_NOTOPIC (331) numeric", NULL}}, {"format.rpl.topic", 1, Val_string, - .str = "topic%{=}\"${3}\"", + .str = "topic%{=}${3}", .strhandle = config_redraws, .description = { "Format of RPL_TOPIC (332) numeric", NULL}}, diff --git a/src/ui.c b/src/ui.c @@ -986,7 +986,7 @@ ui_wprintc(struct Window *window, int lines, char *format, ...) { cc++; } } - if (cc == window->w) { + if (cc == window->w || *s == '\n') { lc++; cc = 0; } @@ -1035,7 +1035,7 @@ ui_strlenc(struct Window *window, char *s, int *lines) { if ((*s & 0xC0) != 0x80) cc++; ret++; - if (window && cc == window->w) { + if (window && cc == window->w || *s == '\n') { lc++; cc = 0; } @@ -1498,6 +1498,16 @@ ui_format(char *format, struct History *hist) { } } + if (escape && *format == 'n') { + ret[rc++] = '\n'; + snprintf(printformat, sizeof(printformat), "%%%lds%%s", + ui_strlenc(NULL, ts, NULL) + config_getl("divider.margin")); + rc += snprintf(&ret[rc], sizeof(ret) - rc, printformat, "", config_gets("divider.string")); + escape = 0; + format++; + continue; + } + if (escape) { ret[rc++] = '\\'; escape = 0; @@ -1505,6 +1515,7 @@ ui_format(char *format, struct History *hist) { if (*format == '\\') { escape = 1; + format++; } else { ret[rc++] = *format; format++;