summary refs log tree commit diff
diff options
context:
space:
mode:
authorKlemens Nanni <klemens@posteo.de>2021-05-23 17:26:19 +0000
committerJune McEnroe <june@causal.agency>2021-05-25 16:11:31 -0400
commit868c604a5548b19cb1678f686172978e3ba52b1a (patch)
tree761d5dcdded4ad653d7e414e3d1f60b2f405c64e
parentUse color enum instead of hardcoded value (diff)
downloadcatgirl-868c604a5548b19cb1678f686172978e3ba52b1a.tar.gz
catgirl-868c604a5548b19cb1678f686172978e3ba52b1a.zip
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...
Diffstat (limited to '')
-rw-r--r--handle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 09b28d5..2607420 100644
--- a/handle.c
+++ b/handle.c
@@ -662,6 +662,11 @@ static void handleTopic(struct Message *msg) {
 	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 (!hashBound) {
+		catf(&cat, "%c%ls%c -> %c%ls%c", R, old, O, R, new, O);
+		goto plain;
+	}
+
 	size_t pre;
 	for (pre = 0; old[pre] && new[pre] && old[pre] == new[pre]; ++pre);
 	wchar_t *osuf = &old[wcslen(old)];
e2b6ec698b5468167cfaea63b598f77bd0&follow=1'>Sort by title if authors matchJune McEnroe There are probably better things to sort by but title definitely always exists. 2021-09-13Swap-remove tags as they're foundJune McEnroe This makes it even faster. From ~1s on a sqlite3.c amalgamation to ~0.85s. 2021-09-12Replace htagml regex with strncmpJune McEnroe Since ctags only ever produces regular expressions of the form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win! 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe This fixes badly indented comments. 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe