about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-02-03 21:50:31 -0500
committerJune McEnroe <june@causal.agency>2022-02-03 21:50:31 -0500
commitceee69f905ef59de46da692e4db7b4cd28c95929 (patch)
treef2a97718ce8af385a4c8e2f93248f3b93d946ff5
parentAvoid sending null byte in SASL PLAIN (diff)
downloadcatgirl-ceee69f905ef59de46da692e4db7b4cd28c95929.tar.gz
catgirl-ceee69f905ef59de46da692e4db7b4cd28c95929.zip
Add C-z s to set spoiler text
-rw-r--r--catgirl.14
-rw-r--r--ui.c23
2 files changed, 16 insertions, 11 deletions
diff --git a/catgirl.1 b/catgirl.1
index 89e982e..7b9af11 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd July 20, 2021
+.Dd February  3, 2022
 .Dt CATGIRL 1
 .Os
 .
@@ -723,6 +723,8 @@ Reset formatting.
 Manually toggle paste mode.
 .It Ic C-z r
 Toggle reverse color.
+.It Ic C-z s
+Set spoiler text (black on black).
 .It Ic C-z u
 Toggle underline.
 .El
diff --git a/ui.c b/ui.c
index 2789bd7..32aaf2b 100644
--- a/ui.c
+++ b/ui.c
@@ -1041,6 +1041,7 @@ static void keyCtrl(wchar_t ch) {
 static void keyStyle(wchar_t ch) {
 	uint id = windows.ptrs[windows.show]->id;
 	if (iswcntrl(ch)) ch = towlower(ch ^ L'@');
+	char buf[8] = {0};
 	enum Color color = Default;
 	switch (ch) {
 		break; case L'A': color = Gray;
@@ -1055,19 +1056,21 @@ static void keyStyle(wchar_t ch) {
 		break; case L'R': color = Red;
 		break; case L'W': color = White;
 		break; case L'Y': color = Yellow;
-		break; case L'b': edit(id, EditInsert, B);
-		break; case L'c': edit(id, EditInsert, C);
-		break; case L'i': edit(id, EditInsert, I);
-		break; case L'o': edit(id, EditInsert, O);
-		break; case L'r': edit(id, EditInsert, R);
-		break; case L'u': edit(id, EditInsert, U);
+		break; case L'b': buf[0] = B;
+		break; case L'c': buf[0] = C;
+		break; case L'i': buf[0] = I;
+		break; case L'o': buf[0] = O;
+		break; case L'r': buf[0] = R;
+		break; case L's': {
+			snprintf(buf, sizeof(buf), "%c%02d,%02d", C, Black, Black);
+		}
+		break; case L'u': buf[0] = U;
 	}
 	if (color != Default) {
-		char buf[4];
 		snprintf(buf, sizeof(buf), "%c%02d", C, color);
-		for (char *ch = buf; *ch; ++ch) {
-			edit(id, EditInsert, *ch);
-		}
+	}
+	for (char *ch = buf; *ch; ++ch) {
+		edit(id, EditInsert, *ch);
 	}
 }
 
an title='2021-05-25 13:39:41 -0400'>2021-05-25import: Add missing scripts/wrap-compiler-for-flag-checkJune McEnroe 2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck. 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe