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.
weechat-hashes
C. McEnroe 2021-02-27 16:28:21 -05:00
parent 06fb025496
commit f4e8f055fb
1 changed files with 7 additions and 4 deletions

11
ui.c
View File

@ -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";