diff options
author | June McEnroe <june@causal.agency> | 2021-02-27 16:28:21 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-02-27 16:28:21 -0500 |
commit | f4e8f055fbd0c0237847935ae87dd0a582133203 (patch) | |
tree | ca6ff52b9351e743585a6c78727272e1349a189c /ui.c | |
parent | Error if hash bound is less than 2 (diff) | |
download | test-f4e8f055fbd0c0237847935ae87dd0a582133203.tar.gz test-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.c | 11 |
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"; |