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>
Этот коммит содержится в:
родитель
1b9957058a
Коммит
26b0623e87
@ -174,11 +174,21 @@ tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
|||||||
ibg = mc_color_pair->ibg;
|
ibg = mc_color_pair->ibg;
|
||||||
attr = mc_color_pair->attr;
|
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;
|
if (ifg >= 8 && ifg < 16)
|
||||||
attr |= A_BOLD;
|
{
|
||||||
|
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);
|
init_pair (mc_color_pair->pair_index, ifg, ibg);
|
||||||
@ -199,7 +209,7 @@ tty_setcolor (int color)
|
|||||||
void
|
void
|
||||||
tty_lowlevel_setcolor (int color)
|
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 *);
|
void tty_color_set_defaults (const char *, const char *, const char *);
|
||||||
|
|
||||||
|
extern gboolean tty_use_256colors(void);
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
#endif /* MC_COLOR_H */
|
#endif /* MC_COLOR_H */
|
||||||
|
@ -292,7 +292,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
|
|||||||
|
|
||||||
tty_reset_prog_mode ();
|
tty_reset_prog_mode ();
|
||||||
load_terminfo_keys ();
|
load_terminfo_keys ();
|
||||||
SLtt_Blink_Mode = 1;
|
|
||||||
|
SLtt_Blink_Mode = tty_use_256colors ()? 1 : 0;
|
||||||
|
|
||||||
tty_start_interrupt_key ();
|
tty_start_interrupt_key ();
|
||||||
|
|
||||||
|
@ -65,15 +65,16 @@ extern int mc_tty_frm[];
|
|||||||
|
|
||||||
extern char *tty_tgetstr (const char *name);
|
extern char *tty_tgetstr (const char *name);
|
||||||
|
|
||||||
extern void tty_beep (void);
|
|
||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ Input }}} */
|
/* {{{ Input }}} */
|
||||||
|
|
||||||
extern int reset_hp_softkeys;
|
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_init (gboolean slow, gboolean ugly_lines);
|
||||||
extern void tty_shutdown (void);
|
extern void tty_shutdown (void);
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user