startup: enter curses mode before reading the nanorc files

This way the COLORS variable will be set when the nanorc files specify
interface colors, so that "light" will work for them.
master
Benno Schulenberg 2020-06-14 12:32:42 +02:00
parent d01dbbb284
commit 24cdf78a93
1 changed files with 15 additions and 11 deletions

View File

@ -2041,6 +2041,18 @@ int main(int argc, char **argv)
}
}
/* Enter into curses mode. Abort if this fails. */
if (initscr() == NULL)
exit(1);
started_curses = TRUE;
#ifdef ENABLE_COLOR
/* If the terminal can do colors, tell ncurses to switch them on. */
if (has_colors())
start_color();
#endif
/* Set up the function and shortcut lists. This needs to be done
* before reading the rcfile, to be able to rebind/unbind keys. */
shortcut_init();
@ -2264,19 +2276,11 @@ int main(int argc, char **argv)
if (tabsize == -1)
tabsize = WIDTH_OF_TAB;
/* Initialize curses mode. If this fails, get out. */
if (initscr() == NULL)
exit(1);
started_curses = TRUE;
#ifdef ENABLE_COLOR
/* If the terminal can do colors, tell ncurses to switch them on, and
* initialize the interface ones. Otherwise just use reverse or bold.*/
if (has_colors()) {
start_color();
/* On capable terminals, use colors, otherwise just reverse or bold.*/
if (has_colors())
set_interface_colorpairs();
} else
else
#endif
{
interface_color_pair[TITLE_BAR] = hilite_attribute;