mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Ticket #2169: Colors fixups for backward compability
* Restored old behaviour of A_BLINK attribute (intensity of background color instead of blinking foreground color); * Added function tty_use_256colors() for determine terminals with 256colors support; * Fixed background highlighting in NCurses and S-Lang. Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
1b9957058a
commit
26b0623e87
@ -174,11 +174,21 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
ibg = mc_color_pair->ibg;
|
||||
attr = mc_color_pair->attr;
|
||||
|
||||
/* In 8 color mode, change bright colors into bold */
|
||||
if (COLORS == 8 && ifg >= 8 && ifg < 16)
|
||||
|
||||
/* In non-256 color mode, change bright colors into bold */
|
||||
if (!tty_use_256colors ())
|
||||
{
|
||||
ifg &= 0x07;
|
||||
attr |= A_BOLD;
|
||||
if (ifg >= 8 && ifg < 16)
|
||||
{
|
||||
ifg &= 0x07;
|
||||
attr |= A_BOLD;
|
||||
}
|
||||
|
||||
if (ibg >= 8 && ibg < 16)
|
||||
{
|
||||
ibg &= 0x07;
|
||||
/* attr | = A_BOLD | A_REVERSE ; */
|
||||
}
|
||||
}
|
||||
|
||||
init_pair (mc_color_pair->pair_index, ifg, ibg);
|
||||
@ -199,7 +209,7 @@ tty_setcolor (int color)
|
||||
void
|
||||
tty_lowlevel_setcolor (int color)
|
||||
{
|
||||
attrset (COLOR_PAIR (color) | color_get_attr (color));
|
||||
tty_setcolor (color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -211,3 +221,11 @@ tty_set_normal_attrs (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
tty_use_256colors (void)
|
||||
{
|
||||
return (COLORS == 256);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -204,3 +204,11 @@ tty_set_normal_attrs (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
tty_use_256colors(void)
|
||||
{
|
||||
return (SLtt_Use_Ansi_Colors && SLtt_tgetnum ((char *) "Co") == 256);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -50,5 +50,7 @@ void tty_set_normal_attrs (void);
|
||||
|
||||
void tty_color_set_defaults (const char *, const char *, const char *);
|
||||
|
||||
extern gboolean tty_use_256colors(void);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif /* MC_COLOR_H */
|
||||
|
@ -292,7 +292,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
|
||||
|
||||
tty_reset_prog_mode ();
|
||||
load_terminfo_keys ();
|
||||
SLtt_Blink_Mode = 1;
|
||||
|
||||
SLtt_Blink_Mode = tty_use_256colors ()? 1 : 0;
|
||||
|
||||
tty_start_interrupt_key ();
|
||||
|
||||
|
@ -65,15 +65,16 @@ extern int mc_tty_frm[];
|
||||
|
||||
extern char *tty_tgetstr (const char *name);
|
||||
|
||||
extern void tty_beep (void);
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
|
||||
/* {{{ Input }}} */
|
||||
|
||||
extern int reset_hp_softkeys;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
extern void tty_beep (void);
|
||||
|
||||
/* {{{ Input }}} */
|
||||
|
||||
extern void tty_init (gboolean slow, gboolean ugly_lines);
|
||||
extern void tty_shutdown (void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user