hirc

IRC client
Log | Files | Refs

commit 8ebad63b5400962ef70bc81d26252c62bb66358a
parent 94f04846eb99066320f8199566229070db39a882
Author: hhvn <dev@hhvn.uk>
Date:   Wed,  1 Dec 2021 23:11:14 +0000

ui.c config.c: default format for numerics

Diffstat:
Mconfig.c | 5+++++
Mui.c | 6++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/config.c b/config.c @@ -262,6 +262,11 @@ struct Config config[] = { .strhandle = config_redraws, .description = { "Format of modes being set on channels", NULL}}, + {"format.rpl.other", 1, Val_string, + .str = "${cmd} ${2-}", + .strhandle = config_redraws, + .description = { + "Format of numerics without formats", NULL}}, {"format.other", 1, Val_string, .str = "${raw}", .strhandle = config_redraws, diff --git a/ui.c b/ui.c @@ -754,6 +754,9 @@ ui_hist_print(struct Window *window, int lines, struct History *hist) { if (formatmap[i].format && strcmp_n(formatmap[i].cmd, cmd) == 0) return ui_wprintc(window, lines, "%s\n", ui_format(config_gets(formatmap[i].format), hist)); + if (isdigit(*cmd) && isdigit(*(cmd+1)) && isdigit(*(cmd+2)) && !*(cmd+3)) + return ui_wprintc(window, lines, "%s\n", ui_format(config_gets("format.rpl.other"), hist)); + raw: return ui_wprintc(window, lines, "%s\n", ui_format(config_gets("format.other"), hist)); } @@ -778,6 +781,9 @@ ui_hist_len(struct Window *window, struct History *hist, int *lines) { if (formatmap[i].format && strcmp_n(formatmap[i].cmd, cmd) == 0) return ui_strlenc(window, ui_format(config_gets(formatmap[i].format), hist), lines); + if (isdigit(*cmd) && isdigit(*(cmd+1)) && isdigit(*(cmd+2)) && !*(cmd+3)) + return ui_strlenc(window, ui_format(config_gets("format.rpl.other"), hist), lines); + raw: return ui_strlenc(window, ui_format(config_gets("format.other"), hist), lines); }