Disable nick and channel colors with hash bound 0

weechat-hashes
C. McEnroe 2021-03-08 10:47:18 -05:00
parent 8f578ee73d
commit 6435dfdda5
3 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,4 @@
.Dd February 15, 2021 .Dd March 8, 2021
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -96,12 +96,15 @@ The default is the first available of
. .
.It Fl H Ar init,bound , Cm hash = Ar init,bound .It Fl H Ar init,bound , Cm hash = Ar init,bound
Set the initial value of Set the initial value of
the nick color hash function the nick and channel
color hash function
and the maximum IRC color value used. and the maximum IRC color value used.
The default is 0,75. The default is 0,75.
To use only colors from To use only colors from
the 16-color terminal set, the 16-color terminal set,
use 0,15. use 0,15.
To disable nick and channel colors,
use 0,0.
. .
.It Fl I Ar pattern , Cm highlight = Ar pattern .It Fl I Ar pattern , Cm highlight = Ar pattern
Add a case-insensitive message highlight pattern, Add a case-insensitive message highlight pattern,

1
chat.c
View File

@ -123,7 +123,6 @@ uint32_t hashBound = 75;
static void parseHash(char *str) { static void parseHash(char *str) {
hashInit = strtoul(str, &str, 0); hashInit = strtoul(str, &str, 0);
if (*str) hashBound = strtoul(&str[1], NULL, 0); if (*str) hashBound = strtoul(&str[1], NULL, 0);
if (hashBound < 2) errx(EX_USAGE, "hash bound must be >= 2");
} }
#ifdef __OpenBSD__ #ifdef __OpenBSD__

1
chat.h
View File

@ -139,6 +139,7 @@ static inline uint idFor(const char *name) {
extern uint32_t hashInit; extern uint32_t hashInit;
extern uint32_t hashBound; extern uint32_t hashBound;
static inline enum Color hash(const char *str) { static inline enum Color hash(const char *str) {
if (hashBound < Blue) return Default;
if (*str == '~') str++; if (*str == '~') str++;
uint32_t hash = hashInit; uint32_t hash = hashInit;
for (; *str; ++str) { for (; *str; ++str) {