summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-27 16:28:21 -0500
committerJune McEnroe <june@causal.agency>2021-02-27 16:28:21 -0500
commitf4e8f055fbd0c0237847935ae87dd0a582133203 (patch)
treeca6ff52b9351e743585a6c78727272e1349a189c /ui.c
parentError if hash bound is less than 2 (diff)
downloadcatgirl-f4e8f055fbd0c0237847935ae87dd0a582133203.tar.gz
catgirl-f4e8f055fbd0c0237847935ae87dd0a582133203.zip
Add workaround for lack of A_ITALIC in old ncurses
A_BLINK has probably always existed, but there's no good reason to
ever use it, so make it do italics instead. Normally all attributes
are set by a single set_attributes string if it's set, so clear it
to force ncurses to use the reassigned enter_blink_mode string. If
the terminal has no enter_italics_mode string, then nothing will
happen.

This makes setting multiple attributes a bit less efficient, but I
don't think it's likely to make much of a difference since using
multiple attributes at once is so uncommon.
Diffstat (limited to '')
-rw-r--r--ui.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ui.c b/ui.c
index 3c6c4ed..d18ea74 100644
--- a/ui.c
+++ b/ui.c
@@ -53,10 +53,6 @@
 #undef lines
 #undef tab
 
-#ifndef A_ITALIC
-#define A_ITALIC A_NORMAL
-#endif
-
 enum {
 	StatusLines = 1,
 	MarkerLines = 1,
@@ -241,6 +237,13 @@ void uiInitEarly(void) {
 	colorInit();
 	atexit(errExit);
 
+#ifndef A_ITALIC
+#define A_ITALIC A_BLINK
+	// Force ncurses to use individual enter_attr_mode strings:
+	set_attributes = NULL;
+	enter_blink_mode = enter_italics_mode;
+#endif
+
 	if (!to_status_line && !strncmp(termname(), "xterm", 5)) {
 		to_status_line = "\33]2;";
 		from_status_line = "\7";
3f488edf3770dc7b641965dbd60bf6e5&follow=1'>Highlight and beep pingsJune McEnroe 2018-08-07Factor out allocating conversion between wcs and mbsJune McEnroe 2018-08-07Match commands case-insensitivelyJune McEnroe 2018-08-07Convert input to multibyte before handlingJune McEnroe 2018-08-07Populate tab-complete listJune McEnroe 2018-08-07Fix /me formatting side-effectsJune McEnroe 2018-08-07Define ui.c BUF_LEN with enumJune McEnroe 2018-08-07Hack clang into checking uiFmt format stringsJune McEnroe 2018-08-07Handle PART and QUIT without messagesJune McEnroe 2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe 2018-08-04Handle /topicJune McEnroe