small addition: allow customizing the color of selected text
The new option 'set selectedcolor' applies to marked text, to the currently selected file in the file browser, and to the highlighted match during interactive search-and-replace.
Этот коммит содержится в:
родитель
276ab2c85e
Коммит
1c1cbae6bc
@ -707,9 +707,9 @@ Do backwards searches by default.
|
|||||||
|
|
||||||
@item set boldtext
|
@item set boldtext
|
||||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||||
function tags, line numbers, and selected text. This can be overridden for
|
function tags, line numbers, and selected text. This can be overridden by
|
||||||
the first five by setting the options @code{titlecolor}, @code{statuscolor},
|
setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||||
@code{keycolor}, @code{functioncolor}, and @code{numbercolor}.
|
@code{functioncolor}, @code{numbercolor}, and @code{selectedcolor}.
|
||||||
|
|
||||||
@item set brackets "@var{string}"
|
@item set brackets "@var{string}"
|
||||||
Set the characters treated as closing brackets when justifying
|
Set the characters treated as closing brackets when justifying
|
||||||
@ -852,6 +852,10 @@ won't work properly with this option enabled.
|
|||||||
@item set regexp
|
@item set regexp
|
||||||
Do extended regular expression searches by default.
|
Do extended regular expression searches by default.
|
||||||
|
|
||||||
|
@item set selectedcolor @var{fgcolor},@var{bgcolor}
|
||||||
|
Use this color combination for selected text.
|
||||||
|
@xref{@code{set functioncolor}} for valid color names.
|
||||||
|
|
||||||
@item set showcursor
|
@item set showcursor
|
||||||
Put the cursor on the highlighted item in the file browser, to aid
|
Put the cursor on the highlighted item in the file browser, to aid
|
||||||
braille users.
|
braille users.
|
||||||
|
10
doc/nanorc.5
10
doc/nanorc.5
@ -79,9 +79,9 @@ Do backwards searches by default.
|
|||||||
.TP
|
.TP
|
||||||
.B set boldtext
|
.B set boldtext
|
||||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||||
function tags, line numbers, and selected text. This can be overridden for
|
function tags, line numbers, and selected text. This can be overridden by
|
||||||
the first five by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP,
|
setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||||
\fBkeycolor\fP, \fBfunctioncolor\fP, and \fBnumbercolor\fP.
|
\fBfunctioncolor\fP, \fBnumbercolor\fP, and \fBselectedcolor\fP.
|
||||||
.TP
|
.TP
|
||||||
.B set brackets "\fIstring\fP"
|
.B set brackets "\fIstring\fP"
|
||||||
Set the characters treated as closing brackets when justifying
|
Set the characters treated as closing brackets when justifying
|
||||||
@ -220,6 +220,10 @@ won't work properly with this option enabled.
|
|||||||
.B set regexp
|
.B set regexp
|
||||||
Do extended regular expression searches by default.
|
Do extended regular expression searches by default.
|
||||||
.TP
|
.TP
|
||||||
|
.B set selectedcolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||||
|
Specify the color combination to use for selected text.
|
||||||
|
See \fBset titlecolor\fR for more details.
|
||||||
|
.TP
|
||||||
.B set showcursor
|
.B set showcursor
|
||||||
Put the cursor on the highlighted item in the file browser, to aid
|
Put the cursor on the highlighted item in the file browser, to aid
|
||||||
braille users.
|
braille users.
|
||||||
|
@ -208,12 +208,14 @@
|
|||||||
## These are examples; by default there are no colors.
|
## These are examples; by default there are no colors.
|
||||||
# set titlecolor brightwhite,blue
|
# set titlecolor brightwhite,blue
|
||||||
# set statuscolor brightwhite,green
|
# set statuscolor brightwhite,green
|
||||||
|
# set selectedcolor brightwhite,magenta
|
||||||
# set numbercolor cyan
|
# set numbercolor cyan
|
||||||
# set keycolor cyan
|
# set keycolor cyan
|
||||||
# set functioncolor green
|
# set functioncolor green
|
||||||
## In root's .nanorc you might want to use:
|
## In root's .nanorc you might want to use:
|
||||||
# set titlecolor brightwhite,red
|
# set titlecolor brightwhite,red
|
||||||
# set statuscolor brightwhite,red
|
# set statuscolor brightwhite,red
|
||||||
|
# set selectedcolor brightwhite,cyan
|
||||||
# set numbercolor magenta
|
# set numbercolor magenta
|
||||||
# set keycolor brightmagenta
|
# set keycolor brightmagenta
|
||||||
# set functioncolor magenta
|
# set functioncolor magenta
|
||||||
|
@ -538,7 +538,7 @@ void browser_refresh(void)
|
|||||||
/* If this is the selected item, start its highlighting, and
|
/* If this is the selected item, start its highlighting, and
|
||||||
* remember its location to be able to place the cursor on it. */
|
* remember its location to be able to place the cursor on it. */
|
||||||
if (i == selected) {
|
if (i == selected) {
|
||||||
wattron(edit, hilite_attribute);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
the_row = row;
|
the_row = row;
|
||||||
the_column = col;
|
the_column = col;
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ void browser_refresh(void)
|
|||||||
|
|
||||||
/* If this is the selected item, finish its highlighting. */
|
/* If this is the selected item, finish its highlighting. */
|
||||||
if (i == selected)
|
if (i == selected)
|
||||||
wattroff(edit, hilite_attribute);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
free(info);
|
free(info);
|
||||||
|
|
||||||
|
@ -2492,6 +2492,7 @@ int main(int argc, char **argv)
|
|||||||
#else
|
#else
|
||||||
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
interface_color_pair[TITLE_BAR] = hilite_attribute;
|
||||||
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
interface_color_pair[LINE_NUMBER] = hilite_attribute;
|
||||||
|
interface_color_pair[SELECTED_TEXT] = hilite_attribute;
|
||||||
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
interface_color_pair[STATUS_BAR] = hilite_attribute;
|
||||||
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
interface_color_pair[KEY_COMBO] = hilite_attribute;
|
||||||
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
interface_color_pair[FUNCTION_TAG] = A_NORMAL;
|
||||||
|
@ -469,6 +469,7 @@ enum
|
|||||||
{
|
{
|
||||||
TITLE_BAR = 0,
|
TITLE_BAR = 0,
|
||||||
LINE_NUMBER,
|
LINE_NUMBER,
|
||||||
|
SELECTED_TEXT,
|
||||||
STATUS_BAR,
|
STATUS_BAR,
|
||||||
KEY_COMBO,
|
KEY_COMBO,
|
||||||
FUNCTION_TAG,
|
FUNCTION_TAG,
|
||||||
|
@ -114,6 +114,7 @@ static const rcoption rcopts[] = {
|
|||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
{"titlecolor", 0},
|
{"titlecolor", 0},
|
||||||
{"numbercolor", 0},
|
{"numbercolor", 0},
|
||||||
|
{"selectedcolor", 0},
|
||||||
{"statuscolor", 0},
|
{"statuscolor", 0},
|
||||||
{"keycolor", 0},
|
{"keycolor", 0},
|
||||||
{"functioncolor", 0},
|
{"functioncolor", 0},
|
||||||
@ -1113,6 +1114,8 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
|
|||||||
specified_color_combo[TITLE_BAR] = option;
|
specified_color_combo[TITLE_BAR] = option;
|
||||||
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
|
else if (strcasecmp(rcopts[i].name, "numbercolor") == 0)
|
||||||
specified_color_combo[LINE_NUMBER] = option;
|
specified_color_combo[LINE_NUMBER] = option;
|
||||||
|
else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0)
|
||||||
|
specified_color_combo[SELECTED_TEXT] = option;
|
||||||
else if (strcasecmp(rcopts[i].name, "statuscolor") == 0)
|
else if (strcasecmp(rcopts[i].name, "statuscolor") == 0)
|
||||||
specified_color_combo[STATUS_BAR] = option;
|
specified_color_combo[STATUS_BAR] = option;
|
||||||
else if (strcasecmp(rcopts[i].name, "keycolor") == 0)
|
else if (strcasecmp(rcopts[i].name, "keycolor") == 0)
|
||||||
|
12
src/winio.c
12
src/winio.c
@ -2650,9 +2650,9 @@ void edit_draw(filestruct *fileptr, const char *converted,
|
|||||||
paintlen = actual_x(thetext, end_col - start_col);
|
paintlen = actual_x(thetext, end_col - start_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
wattron(edit, hilite_attribute);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
mvwaddnstr(edit, row, margin + start_col, thetext, paintlen);
|
mvwaddnstr(edit, row, margin + start_col, thetext, paintlen);
|
||||||
wattroff(edit, hilite_attribute);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
@ -3417,7 +3417,7 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
|||||||
room--;
|
room--;
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
wattron(edit, hilite_attribute);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
waddnstr(edit, word, actual_x(word, room));
|
waddnstr(edit, word, actual_x(word, room));
|
||||||
|
|
||||||
@ -3425,7 +3425,7 @@ void spotlight(bool active, size_t from_col, size_t to_col)
|
|||||||
waddch(edit, '$');
|
waddch(edit, '$');
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
wattroff(edit, hilite_attribute);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
free(word);
|
free(word);
|
||||||
|
|
||||||
@ -3464,12 +3464,12 @@ void spotlight_softwrapped(bool active, size_t from_col, size_t to_col)
|
|||||||
break_col - from_col, FALSE);
|
break_col - from_col, FALSE);
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
wattron(edit, hilite_attribute);
|
wattron(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
waddnstr(edit, word, actual_x(word, break_col));
|
waddnstr(edit, word, actual_x(word, break_col));
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
wattroff(edit, hilite_attribute);
|
wattroff(edit, interface_color_pair[SELECTED_TEXT]);
|
||||||
|
|
||||||
free(word);
|
free(word);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comm
|
|||||||
# Keywords
|
# Keywords
|
||||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|justifytrim|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|justifytrim|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||||
icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|status|title)color)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|numbercolor|operatingdir|punct|quotestr|selectedcolor|speller|statuscolor|titlecolor|whitespace|wordchars)[[:space:]]+"
|
||||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]0-9\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|formatter)[[:space:]]+.*$"
|
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|formatter)[[:space:]]+.*$"
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user