mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-08 02:32:00 +03:00
startup: initialize colors only when the terminal is capable of colors
This avoids trying to show colors on a vt100, for example.
This commit is contained in:
parent
d1e1438ca0
commit
5ca2fd887a
@ -110,10 +110,6 @@ void prepare_palette(void)
|
||||
bool using_defaults = FALSE;
|
||||
short foreground, background;
|
||||
|
||||
/* If the terminal is not capable of colors, forget it. */
|
||||
if (!has_colors())
|
||||
return;
|
||||
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
/* Allow using the default colors, if available. */
|
||||
using_defaults = (use_default_colors() != ERR);
|
||||
|
24
src/nano.c
24
src/nano.c
@ -2254,17 +2254,21 @@ int main(int argc, char **argv)
|
||||
started_curses = TRUE;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
set_interface_colorpairs();
|
||||
#else
|
||||
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
||||
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
||||
interface_color_pair[GUIDE_STRIPE] = A_REVERSE;
|
||||
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
|
||||
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
||||
interface_color_pair[ERROR_MESSAGE] = hilite_attribute;
|
||||
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
||||
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
||||
/* On capable terminals, use colors, otherwise use just reverse or bold.*/
|
||||
if (has_colors())
|
||||
set_interface_colorpairs();
|
||||
else
|
||||
#endif
|
||||
{
|
||||
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
||||
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
||||
interface_color_pair[GUIDE_STRIPE] = A_REVERSE;
|
||||
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
|
||||
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
||||
interface_color_pair[ERROR_MESSAGE] = hilite_attribute;
|
||||
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
||||
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
||||
}
|
||||
|
||||
/* Set up the terminal state. */
|
||||
terminal_init();
|
||||
|
@ -3258,8 +3258,8 @@ void edit_refresh(void)
|
||||
int row = 0;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* When needed, initialize the colors for the current syntax. */
|
||||
if (!have_palette)
|
||||
/* When needed and useful, initialize the colors for the current syntax. */
|
||||
if (!have_palette && has_colors())
|
||||
prepare_palette();
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user