Skip to content

Commit

Permalink
Ticket #4433: skins: add color for non-printable characters in editor.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Borodin <[email protected]>
  • Loading branch information
aborodin committed Dec 10, 2023
1 parent ea6bd18 commit 1b3684e
Show file tree
Hide file tree
Showing 40 changed files with 65 additions and 34 deletions.
4 changes: 2 additions & 2 deletions doc/man/es/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -3405,8 +3405,8 @@ de error: errdfocus, errdhotnormal, errdhotfocus, errdtitle; los colores
de la ayuda: helpnormal, helpitalic, helpbold, helplink, helpslink,
helptitle; los colores del visor: viewnormal, viewbold, viewunderline,
viewselected; loc colores del editor: editnormal, editbold, editmarked,
editwhitespace, editlinestate; los colores de los menús desplegables:
pmenunormal, pmenusel, pmenutitle.
editwhitespace, editnonprintable, editlinestate; los colores de los menús
desplegables: pmenunormal, pmenusel, pmenutitle.
.PP
.I header
determina el color del encabezado de los paneles, la línea con los
Expand Down
2 changes: 1 addition & 1 deletion doc/man/hu/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,7 @@ dhotnormal, dhotfocus; Súgó színek: helpnormal, helpitalic, helpbold,
helplink, helpslink; Fájlnéző színek: viewunderline; Speciális kijelölés
színei: executable, directory, link, stalelink, device, special, core;
Viewer colors are: viewnormal, viewbold, viewunderline, viewselected.
Szerkesztő színei: editnormal, editbold, editmarked.
Szerkesztő színei: editnormal, editbold, editmarked, editnonprintable.
.PP
.I input
maghatározza a beviteli sorok színét a dialogus ablakora vonatkozóan.
Expand Down
2 changes: 1 addition & 1 deletion doc/man/it/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -2881,7 +2881,7 @@ Il colore del visualizzatore è: viewunderline.
Colori speciali di evidenziazione: executable, directory, link, device,
special, core.
I colori dell'viewer sono: viewnormal, viewbold, viewunderline, viewselected.
I colori dell'editor sono: editnormal, editbold, editmarked.
I colori dell'editor sono: editnormal, editbold, editmarked, editnonprintable.
.PP
.I input
determina il colore delle righe di input usate delle finestre di dialogo.
Expand Down
4 changes: 2 additions & 2 deletions doc/man/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -3513,8 +3513,8 @@ dhotnormal, dhotfocus, dtitle. Error dialog colors are: errdfocus, errdhotnormal
errdhotfocus, errdtitle. Help colors are: helpnormal, helpitalic, helpbold,
helplink, helpslink, helptitle. Viewer colors are: viewnormal, viewbold,
viewunderline, viewselected. Editor colors are: editnormal, editbold, editmarked,
editwhitespace, editlinestate. Popup menu colors are: pmenunormal, pmenusel,
pmenutitle.
editwhitespace, editnonprintable, editlinestate. Popup menu colors are: pmenunormal,
pmenusel, pmenutitle.
.PP
.I header
determines the color of panel header, the line that contains column titles
Expand Down
4 changes: 2 additions & 2 deletions doc/man/pl/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -2542,8 +2542,8 @@ dhotfocus; Kolory pomocy: helpnormal, helpitalic, helpbold, helplink,
helpslink; Kolory podglądu: viewunderline; Specjalne tryby podświetlenia:
executable, directory, link, device, special. Viewer colors are: viewnormal,
viewbold, viewunderline, viewselected. Editor colors are: editnormal, editbold,
editmarked, editwhitespace, editlinestate. Popup menu colors are: pmenunormal,
pmenusel, pmenutitle.
editmarked, editwhitespace, editnonprintable, editlinestate. Popup menu colors
are: pmenunormal, pmenusel, pmenutitle.
[nie tłumaczyłem nazw z racji tego, że trzeba je stosować w ich angielskim
brzmieniu \- jeśli jesteś aż tak zaawansowany, użyj słownika].
.PP
Expand Down
3 changes: 2 additions & 1 deletion doc/man/ru/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -4019,7 +4019,8 @@ bbarhotkey, bbarbutton.
Цвета в диалоге\-сообщении об ошибке: errdfocus, errdhotnormal, errdhotfocus, errdtitle.
Цвета в окне встроенной помощи: helpnormal, helpitalic, helpbold, helplink, helpslink.
Цвета в окне программы просмотра: viewnormal, viewbold, viewunderline, viewselected.
Цвета в редакторе: editnormal, editbold, editmarked, editwhitespace, editlinestate.
Цвета в редакторе: editnormal, editbold, editmarked, editwhitespace, editnonprintable,
editlinestate.
Цвета окна всплывающего меню: pmenunormal, pmenusel, pmenutitle.
.PP
Цвета задавать не обязательно. Цвет какого именно поля определяется
Expand Down
2 changes: 1 addition & 1 deletion doc/man/sr/mc.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@ dnormal, dfocus, dhotnormal, dhotfocus. Боје помоћи су: helpnormal,
helpbold, helplink, helpslink. Боја прегледача је: viewunderline.
Посебне боје за истицање су: executable, directory, link, stalelink,
device, special, core. Viewer colors are: viewnormal, viewbold, viewunderline,
viewselected. Боје уређивача су: editnormal, editbold, editmarked.
viewselected. Боје уређивача су: editnormal, editbold, editmarked, editnonprintable.
.PP
.I input
одређује боју редова за унос који се користе у дијалозима упита.
Expand Down
39 changes: 20 additions & 19 deletions lib/skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,29 @@
* Last is defined to view color.
*/
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[49]
#define EDITOR_BOLD_COLOR mc_skin_color__cache[50]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[51]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[52]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[53]
#define EDITOR_BACKGROUND mc_skin_color__cache[54]
#define EDITOR_FRAME mc_skin_color__cache[55]
#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[56]
#define EDITOR_FRAME_DRAG mc_skin_color__cache[57]
#define EDITOR_NONPRINTABLE_COLOR mc_skin_color__cache[50]
#define EDITOR_BOLD_COLOR mc_skin_color__cache[51]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[52]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[53]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[54]
#define EDITOR_BACKGROUND mc_skin_color__cache[55]
#define EDITOR_FRAME mc_skin_color__cache[56]
#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[57]
#define EDITOR_FRAME_DRAG mc_skin_color__cache[58]
/* color of left 8 char status per line */
#define LINE_STATE_COLOR mc_skin_color__cache[58]
#define BOOK_MARK_COLOR mc_skin_color__cache[59]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[60]
#define LINE_STATE_COLOR mc_skin_color__cache[59]
#define BOOK_MARK_COLOR mc_skin_color__cache[60]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[61]

/* Diff colors */
#define DFF_ADD_COLOR mc_skin_color__cache[61]
#define DFF_CHG_COLOR mc_skin_color__cache[62]
#define DFF_CHH_COLOR mc_skin_color__cache[63]
#define DFF_CHD_COLOR mc_skin_color__cache[64]
#define DFF_DEL_COLOR mc_skin_color__cache[65]
#define DFF_ERROR_COLOR mc_skin_color__cache[66]

#define MC_SKIN_COLOR_CACHE_COUNT 67
#define DFF_ADD_COLOR mc_skin_color__cache[62]
#define DFF_CHG_COLOR mc_skin_color__cache[63]
#define DFF_CHH_COLOR mc_skin_color__cache[64]
#define DFF_CHD_COLOR mc_skin_color__cache[65]
#define DFF_DEL_COLOR mc_skin_color__cache[66]
#define DFF_ERROR_COLOR mc_skin_color__cache[67]

#define MC_SKIN_COLOR_CACHE_COUNT 68

/*** enums ***************************************************************************************/

Expand Down
1 change: 1 addition & 0 deletions lib/skin/colors-old.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static const mc_skin_colors_old_t old_colors[] = {
{"editframedrag", "editor", "editframedrag"},
{"editlinestate", "editor", "editlinestate"},
{"editmarked", "editor", "editmarked"},
{"editnonprintable", "editor", "editnonprintable"},
{"editnormal", "editor", "_default_"},
{"editwhitespace", "editor", "editwhitespace"},
{"errdhotfocus", "error", "errdhotfocus"},
Expand Down
1 change: 1 addition & 0 deletions lib/skin/colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ mc_skin_color_cache_init (void)
EDITOR_BOLD_COLOR = mc_skin_color_get ("editor", "editbold");
EDITOR_MARKED_COLOR = mc_skin_color_get ("editor", "editmarked");
EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace");
EDITOR_NONPRINTABLE_COLOR = mc_skin_color_get ("editor", "editnonprintable");
EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin");
LINE_STATE_COLOR = mc_skin_color_get ("editor", "editlinestate");
EDITOR_BACKGROUND = mc_skin_color_get ("editor", "editbg");
Expand Down
1 change: 1 addition & 0 deletions misc/skins/dark.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
editbold = yellow;green
editmarked = black;lightgray
editwhitespace = brightblue;black
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/darkfar.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
editbold = yellow;green
editmarked = black;lightgray
editwhitespace = brightblue;black
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
editbold = yellow;green
editmarked = black;cyan
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/double-lines.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
editbold = yellow;green
editmarked = black;cyan
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/featured-plus.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
editbold = yellow;green
editmarked = black;cyan
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/featured.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
editmarked = black;cyan
editwhitespace = brightblue;blue
editlinestate = white;cyan
editnonprintable = ;black
bookmark = white;red
bookmarkfound = black;green
editrightmargin = brightblue;black
Expand Down
1 change: 1 addition & 0 deletions misc/skins/gotar.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
editbold = yellow;blue
editmarked = brightgreen;red
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = brightgreen
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/gray-green-purple256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
editbold = rgb400
editmarked = ;main1
editwhitespace = rgb400;bgdarker
editnonprintable = ;black
editlinestate = ;bgdarker
bookmark = ;rgb531
bookmarkfound = ;main2
Expand Down
1 change: 1 addition & 0 deletions misc/skins/gray-orange-blue256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
editbold = rgb400
editmarked = ;main1
editwhitespace = rgb400;bgdarker
editnonprintable = ;black
editlinestate = ;bgdarker
bookmark = ;rgb531
bookmarkfound = ;main2
Expand Down
1 change: 1 addition & 0 deletions misc/skins/julia256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
editbold = yellow;green
editmarked = black;lightgray
editwhitespace = brightblue;black
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/mc46.ini
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
editbold = yellow;
editmarked = black;cyan
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarcon16-defbg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color15;;bold
editmarked = color11;color2;bold
editwhitespace = color12;color4
editnonprintable = ;black
editlinestate = color2;color0
bookmark = color0;color7
bookmarkfound = color0;color7
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarcon16.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color15;;bold
editmarked = color11;color2;bold
editwhitespace = color2;color0
editnonprintable = ;black
editlinestate = color2;color0
bookmark = color0;color7
bookmarkfound = color0;color7
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarcon16root-defbg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color15;;bold
editmarked = color11;color1;bold
editwhitespace = color12;color4
editnonprintable = ;black
editlinestate = color1;color0
bookmark = color0;color7
bookmarkfound = color0;color7
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarcon16root.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color15;;bold
editmarked = color11;color1;bold
editwhitespace = color12;color4
editnonprintable = ;black
editlinestate = color1;color0
bookmark = color0;color7
bookmarkfound = color0;color7
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarin256-defbg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color228;;bold
editmarked = color228;color23;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color66;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarin256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color228;;bold
editmarked = color228;color23;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color66;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarin256root-defbg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color228;;bold
editmarked = color228;color88;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color95;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/modarin256root.ini
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
editbold = color228;;bold
editmarked = color228;color88;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color95;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/nicedark.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
editbold = brown;blue
editmarked = black;cyan
editwhitespace = brightblue;blue
editnonprintable = ;black
editlinestate = white;cyan
bookmark = white;red
bookmarkfound = black;green
Expand Down
1 change: 1 addition & 0 deletions misc/skins/sand256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
editbold = rgb400
editmarked = ;rgb452;italic
editwhitespace = rgb400;rgb553
editnonprintable = ;black
editlinestate = ;rgb553
bookmark = ;rgb551
bookmarkfound = ;rgb530
Expand Down
1 change: 1 addition & 0 deletions misc/skins/seasons-autumn16M.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
editbold = MarkedFg;;bold
editmarked = ;Selected
editwhitespace = ;EditorWhitespace
editnonprintable = ;black
editlinestate = #000;EditorLineNumber
bookmark = #000;EditorBookmark
bookmarkfound = #000;EditorFindAll
Expand Down
1 change: 1 addition & 0 deletions misc/skins/seasons-spring16M.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
editbold = MarkedFg;;bold
editmarked = ;Selected
editwhitespace = ;EditorWhitespace
editnonprintable = ;black
editlinestate = #000;EditorLineNumber
bookmark = #000;EditorBookmark
bookmarkfound = #000;EditorFindAll
Expand Down
1 change: 1 addition & 0 deletions misc/skins/seasons-summer16M.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
editbold = MarkedFg;;bold
editmarked = ;Selected
editwhitespace = ;EditorWhitespace
editnonprintable = ;black
editlinestate = #000;EditorLineNumber
bookmark = #000;EditorBookmark
bookmarkfound = #000;EditorFindAll
Expand Down
1 change: 1 addition & 0 deletions misc/skins/seasons-winter16M.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
editbold = MarkedFg;;bold
editmarked = ;Selected
editwhitespace = ;EditorWhitespace
editnonprintable = ;black
editlinestate = #000;EditorLineNumber
bookmark = #000;EditorBookmark
bookmarkfound = #000;EditorFindAll
Expand Down
1 change: 1 addition & 0 deletions misc/skins/xoria256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
editbold = ;;bold
editmarked = ;color60
editwhitespace = color236;color234
editnonprintable = ;black
editlinestate = ;color235
bookmark = ;color239;
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/yadt256-defbg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
editbold = color228;;bold
editmarked = color228;blue;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color66;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
1 change: 1 addition & 0 deletions misc/skins/yadt256.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
editbold = color228;;bold
editmarked = color228;blue;bold
editwhitespace = color56;color234
editnonprintable = ;black
editlinestate = color66;color235
bookmark = ;color239
bookmarkfound = ;color239;bold
Expand Down
2 changes: 1 addition & 1 deletion src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ mc_args_new_color_group (void)
" errdhotfocus\n"
" Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
" Popup menus: pmenunormal, pmenusel, pmenutitle\n"
" Editor: editnormal, editbold, editmarked, editwhitespace,\n"
" Editor: editnormal, editbold, editmarked, editwhitespace, editnonprintable,\n"
" editlinestate, editbg, editframe, editframeactive\n"
" editframedrag\n"
" Viewer: viewnormal,viewbold, viewunderline, viewselected\n"
Expand Down
7 changes: 3 additions & 4 deletions src/editor/editdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
{
int style;
unsigned int textchar;
int color;

if (cols_to_skip != 0)
{
Expand All @@ -458,8 +457,6 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,

style = p->style & 0xFF00;
textchar = p->ch;
/* If non-printable - use black background */
color = (style & MOD_ABNORMAL) != 0 ? 0 : p->style >> 16;

if ((style & MOD_WHITESPACE) != 0)
{
Expand All @@ -475,8 +472,10 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
tty_setcolor (EDITOR_BOLD_COLOR);
else if ((style & MOD_MARKED) != 0)
tty_setcolor (EDITOR_MARKED_COLOR);
else if ((style & MOD_ABNORMAL) != 0)
tty_setcolor (EDITOR_NONPRINTABLE_COLOR);
else
tty_lowlevel_setcolor (color);
tty_lowlevel_setcolor (p->style >> 16);

if (edit_options.show_right_margin)
{
Expand Down

0 comments on commit 1b3684e

Please sign in to comment.