about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-01-10 20:57:03 +0100
committerOliver Kiddle <opk@zsh.org>2023-01-10 20:57:03 +0100
commitc01479a2ede78b9b53057322e4b9f5bd0a103a00 (patch)
treefb02cafa81ade7ee2dbbfc72c81b09c8d9add1bb /Src/init.c
parent667ead3a64e590ac758e9f0a053849c7aaccec66 (diff)
downloadzsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.tar.gz
zsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.tar.xz
zsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.zip
51280: add support for italic and faint fonts in the line editor
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/Src/init.c b/Src/init.c
index 75ef2e094..68621a0ad 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -747,7 +747,7 @@ init_shout(void)
 static char *tccapnams[TC_COUNT] = {
     "cl", "le", "LE", "nd", "RI", "up", "UP", "do",
     "DO", "dc", "DC", "ic", "IC", "cd", "ce", "al", "dl", "ta",
-    "md", "so", "us", "me", "se", "ue", "ch",
+    "md", "mh", "so", "us", "ZH", "me", "se", "ue", "ZR", "ch",
     "ku", "kd", "kl", "kr", "sc", "rc", "bc", "AF", "AB"
 };
 
@@ -872,6 +872,23 @@ init_term(void)
 	/* The following is an attempt at a heuristic,
 	 * but it fails in some cases */
 	/* rprompt_indent = ((hasam && !hasbw) || hasye || !tccan(TCLEFT)); */
+
+	/* if there's no termcap entry for italics, use CSI 3 m */
+	if (!tccan(TCITALICSBEG)) {
+	    zsfree(tcstr[TCITALICSBEG]);
+	    tcstr[TCITALICSBEG] = ztrdup("\033[3m");
+	    tclen[TCITALICSBEG] = 4;
+	}
+	if (!tccan(TCITALICSEND)) {
+	    zsfree(tcstr[TCITALICSEND]);
+	    tcstr[TCITALICSEND] = ztrdup("\033[23m");
+	    tclen[TCITALICSEND] = 5;
+	}
+	if (!tccan(TCFAINTBEG)) {
+	    zsfree(tcstr[TCFAINTBEG]);
+	    tcstr[TCFAINTBEG] = ztrdup("\033[2m");
+	    tclen[TCFAINTBEG] = 4;
+	}
     }
     return 1;
 }