tweaks: elide a typedef, as it now has just one element

This commit is contained in:
Benno Schulenberg 2016-07-12 09:35:48 +02:00
parent b4737072a6
commit 960e848cc7
7 changed files with 21 additions and 27 deletions

View File

@ -62,14 +62,14 @@ void set_colorpairs(void)
if (background == -1 && !using_defaults)
background = COLOR_BLACK;
init_pair(i + 1, foreground, background);
interface_color_pair[i].pairnum =
interface_color_pair[i] =
COLOR_PAIR(i + 1) | (bright ? A_BOLD : A_NORMAL);
}
else {
if (i != FUNCTION_TAG)
interface_color_pair[i].pairnum = hilite_attribute;
interface_color_pair[i] = hilite_attribute;
else
interface_color_pair[i].pairnum = A_NORMAL;
interface_color_pair[i] = A_NORMAL;
}
free(specified_color_combo[i]);

View File

@ -212,7 +212,7 @@ int hilite_attribute = A_REVERSE;
char* specified_color_combo[] = {};
/* The color combinations as specified in the rcfile. */
#endif
color_pair interface_color_pair[] = {};
int interface_color_pair[] = {};
/* The processed color pairs for the interface elements. */
char *homedir = NULL;

View File

@ -2506,10 +2506,10 @@ int main(int argc, char **argv)
#ifndef DISABLE_COLOR
set_colorpairs();
#else
interface_color_pair[TITLE_BAR].pairnum = hilite_attribute;
interface_color_pair[STATUS_BAR].pairnum = hilite_attribute;
interface_color_pair[KEY_COMBO].pairnum = hilite_attribute;
interface_color_pair[FUNCTION_TAG].pairnum = A_NORMAL;
interface_color_pair[TITLE_BAR] = hilite_attribute;
interface_color_pair[STATUS_BAR] = hilite_attribute;
interface_color_pair[KEY_COMBO] = hilite_attribute;
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
#endif
#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED)

View File

@ -199,12 +199,6 @@ typedef enum {
} undo_type;
/* Structure types. */
typedef struct color_pair {
int pairnum;
/* The color pair number used for this foreground color and
* background color. */
} color_pair;
#ifndef DISABLE_COLOR
typedef struct colortype {
short fg;

View File

@ -491,7 +491,7 @@ void update_the_statusbar(void)
index = strnlenpt(answer, statusbar_x);
page_start = get_statusbar_page_start(start_col, start_col + index);
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
blank_statusbar();
@ -503,7 +503,7 @@ void update_the_statusbar(void)
waddstr(bottomwin, expanded);
free(expanded);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
@ -852,12 +852,12 @@ int do_yesno_prompt(bool all, const char *msg)
onekey("^C", _("Cancel"), width);
}
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
/* Refresh edit window and statusbar before getting input. */
wnoutrefresh(edit);

View File

@ -142,7 +142,7 @@ extern int hilite_attribute;
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
extern color_pair interface_color_pair[NUMBER_OF_ELEMENTS];
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
extern char *homedir;

View File

@ -1868,7 +1868,7 @@ void titlebar(const char *path)
assert(path != NULL || openfile->filename != NULL);
wattron(topwin, interface_color_pair[TITLE_BAR].pairnum);
wattron(topwin, interface_color_pair[TITLE_BAR]);
blank_titlebar();
@ -1955,7 +1955,7 @@ void titlebar(const char *path)
else if (statelen > 0)
mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
wattroff(topwin, interface_color_pair[TITLE_BAR].pairnum);
wattroff(topwin, interface_color_pair[TITLE_BAR]);
wnoutrefresh(topwin);
reset_cursor();
@ -2024,12 +2024,12 @@ void statusline(message_type importance, const char *msg, ...)
start_x = (COLS - strlenpt(foo) - 4) / 2;
wmove(bottomwin, 0, start_x);
wattron(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
wattron(bottomwin, interface_color_pair[STATUS_BAR]);
waddstr(bottomwin, "[ ");
waddstr(bottomwin, foo);
free(foo);
waddstr(bottomwin, " ]");
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
wattroff(bottomwin, interface_color_pair[STATUS_BAR]);
/* Push the message to the screen straightaway. */
wnoutrefresh(bottomwin);
@ -2126,17 +2126,17 @@ void onekey(const char *keystroke, const char *desc, int length)
{
assert(keystroke != NULL && desc != NULL);
wattron(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
wattron(bottomwin, interface_color_pair[KEY_COMBO]);
waddnstr(bottomwin, keystroke, actual_x(keystroke, length));
wattroff(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
wattroff(bottomwin, interface_color_pair[KEY_COMBO]);
length -= strlenpt(keystroke) + 1;
if (length > 0) {
waddch(bottomwin, ' ');
wattron(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
wattron(bottomwin, interface_color_pair[FUNCTION_TAG]);
waddnstr(bottomwin, desc, actual_x(desc, length));
wattroff(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
wattroff(bottomwin, interface_color_pair[FUNCTION_TAG]);
}
}