Use reverse video not colors for topic change when disabled

`-H 0,0`/"hash = 0,0" makes catgirl mostly colorless which is great,
but topic changes still hardcode brown/green colors to show differences
which is usually not desired by users (like me) disabling colors.

Go for a less eye stressing topic change message that shows both old
and new in reverse video with default terminal colors.

This isn't perfect, other parts of catgirl still hardcode colors and
`-H 0,0`/"hash = 0,0" was never meant to disable colors completely, but
topics change often enough that avoiding less readable^Waccessible topic
diffs seems sensible enough.

NB: parseHash() is brittle and "0,0" is not the only value disabling
colors...
weechat-hashes
Klemens Nanni 2021-05-23 17:26:19 +00:00 committed by C. McEnroe
parent f9a36441e0
commit 868c604a55
1 changed files with 5 additions and 0 deletions

View File

@ -662,6 +662,11 @@ static void handleTopic(struct Message *msg) {
if (swprintf(old, ARRAY_LEN(old), L"%s", prev) < 0) goto plain; if (swprintf(old, ARRAY_LEN(old), L"%s", prev) < 0) goto plain;
if (swprintf(new, ARRAY_LEN(new), L"%s", msg->params[1]) < 0) goto plain; if (swprintf(new, ARRAY_LEN(new), L"%s", msg->params[1]) < 0) goto plain;
if (!hashBound) {
catf(&cat, "%c%ls%c -> %c%ls%c", R, old, O, R, new, O);
goto plain;
}
size_t pre; size_t pre;
for (pre = 0; old[pre] && new[pre] && old[pre] == new[pre]; ++pre); for (pre = 0; old[pre] && new[pre] && old[pre] == new[pre]; ++pre);
wchar_t *osuf = &old[wcslen(old)]; wchar_t *osuf = &old[wcslen(old)];