If someone experiences strange colors in the text edition

try "make clean; make".

Tue Dec 29 15:49:45 1998  Norbert Warmuth  <nwarmuth@privat.circular.de>

* doc/mc.sgml, mc1.in (Color section): minor polishing
(Layout section): documented Highlight...

* gnome/gmain.c: According to the man page the color keyword for executable
files 	is `executable' and not `execute' -- changed.

* file.c (progress_update_one): Ignore files in subdirectories
when panel totals haven't been computed.

(erase_dir, erase_file): update progress bar (i.e. make it work
for OP_DELETE).

(panel_operate_flags): Don't compute panel totals for OP_MOVE.
When moving files on the same filesystem computing totals might
last much longer than the actual move operation.

(various places): adpations for the above changes.

* slint.c (try_alloc_color_pair): Changed hardcoded values into
defines.

* color.c, text.c: Added color "stalledlink" which is used for
stalled symbolic links. Formerly "viewunderline" was used for
this (IMO bad because function and name didn't match).
According to the man page the color keyword for executable files
is `executable' and not `execute' -- changed.

* color.c, color.h: When using SLang some color indexes are not
freely choosable (DEFAULT_COLOR clashed with A_BOLD_REVERSE).
Solved by adding holes in color_map.

* find.c (do_search): fixed possible memory leak
This commit is contained in:
Norbert Warmuth 1998-12-29 16:52:49 +00:00
parent 66558b5f73
commit ffb83af112
15 changed files with 321 additions and 187 deletions

View File

@ -1,3 +1,8 @@
Tue Dec 29 15:49:45 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* doc/mc.sgml, mc1.in (Color section): minor polishing
(Layout section): documented Highlight...
Thu Dec 24 18:30:53 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* configure.in: Deleted du checks

View File

@ -1800,6 +1800,28 @@ can specify whether the area is split to the panels in vertical or
horizontal direction. The split can be equal or you can specify an
unequal split.
.PP
By default all contents of the directory panels are displayed with
the same color, but you can specify whether
.I permissions
and
.I file types
are highlighted with special
.\"LINK2"
Colors.
.\"Colors"
If permission highlighting is enabled, the parts of the
.I perm
and
.I mode
.\"LINK2"
display fields
.\"Listing Mode..."
which are valid for the user running Midnight Commander
are highlighted with the color defined with the
.I selected
keyword. If file type highlighting is enabled, files are colored according
to their file type (e.g. directory, core file, executable, ...).
.PP
If the
.I Show Mini-Status
option is enabled, one line of status
@ -2798,12 +2820,22 @@ The format for the color definition is:
<keyword>=<foregroundcolor>,<backgroundcolor>:<keyword>= ...
.fi
.PP
The colors are optional, and the keywords are: normal, selected,
marked, markselect, errors, input, reverse menu, menusel, menuhot, menuhotsel,
gauge; the dialog colors are: dnormal, dfocus, dhotnormal, dhotfocus;
Help colors are: helpnormal, helpitalic, helpbold, helplink,
helpslink; Viewer color is: viewunderline; Special highlighting mode:
executable, directory, link, device, special.
The colors are optional, and the keywords are: normal,
selected, marked, markselect, errors, input, reverse, gauge;
Menu colors are: menu, menusel, menuhot, menuhotsel; Dialog colors
are: dnormal, dfocus, dhotnormal, dhotfocus; Help colors
are: helpnormal, helpitalic, helpbold, helplink, helpslink;
Viewer color is: viewunderline; Special highlighting colors are:
executable, directory, link, device, special, core; Editor colors
are: editnormal, editbold, editmarked.
.PP
.I input
determines the color of input lines used in query dialogs.
.PP
.I gauge
determines the color of the filled part of the progress bar
(gauge), which shows how many percent of files were copied
etc. in a graphical way.
.PP
The dialog boxes use the following colors:
.I dnormal
@ -2832,29 +2864,27 @@ is used for not selected hyperlinks and
.I helpslink
is used for selected hyperlink.
.PP
.I gauge
determines color of filled part of the progress bar (gauge), which shows
how many percent of files were copied etc. in a graphical way.
.PP
For file type highlighting mode
Special highlight colors determine how files are displayed
when file highlighting is enabled (see the section on
.\"LINK2"
Layout).
.\"Layout
.I directory
specifies the color in which directories are shown;
is used for directories or symbolic links to directories;
.I executable
for executable files;
.I link
is used to represent links;
.I device
for character and block devices;
.I link
is used for symbolic links which are neither stalled nor linked
to a directory;
.I stalledlink
is used for stalled symbolic links;
.I device
- character and block devices;
.I special
is for special files, such as FIFO and IPC sockets;
is used for special files, such as FIFOs and IPC
sockets;
.I core
is for core files (see also the option
.B highlight_mode
at the section on
.\"LINK2"
Special Settings).
.\"Special Settings"
is for core files.
.PP
The possible colors are: black, gray, red, brightred, green,
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
@ -2971,24 +3001,6 @@ over it; else go to the bottom line unless you already are at the
bottom line, in such case it will move the selection to the last file
name in the panel.
.PP
.I highlight_mode
By default all information on panels displayed with
the same color. If this variable is set to 1, then
.I perm
or
.I mode
tokens in display format get ability to show access rights of the user
to the shown file. Appropriate triplet of reading, writing and execution rights
highlighted with the yellow (
.I selected
) color. In addition, if the variable
is equal to 2, then all lines are displaying by the color according to
their type (see
.\"LINK2"
Colors).
.\"Colors"
Permissions highlighting also works in this mode.
.PP
.I use_file_to_guess_type
.IP
If this variable is on (the default) it will spawn the file command to

View File

@ -1467,6 +1467,17 @@ panels. You can specify whether the area is split to the
panels in vertical or horizontal direction. The split can
be equal or you can specify an unequal split.
By default all contents of the directory panels are displayed with
the same color, but you can specify whether <em/permissions/ and
<em/file types/ are highlighted with special <lnk name="Colors" id="Colors">.
If permission highlighting is enabled, the parts of the <em/perm/
and <em/mode/ <lnk name="display fields" lnk id="Listing Mode...">
which are valid for the user running Midnight Commander
are highlighted with the color defined with the <em/selected/
keyword.
If file type highlighting is enabled, files are colored according
to their file type (e.g. directory, core file, executable, ...).
If the <em/Show Mini-Status/ option is enabled, one line of status
information about the currently selected item is showed at the bottom
of the panels.
@ -2367,14 +2378,20 @@ The format for the color definition is:
</verb></tscreen>
The colors are optional, and the keywords are: normal,
selected, marked, markselect, errors, input, reverse menu,
menusel, menuhot, menuhotsel, gauge; the dialog colors
selected, marked, markselect, errors, input, reverse, gauge;
Menu colors are: menu, menusel, menuhot, menuhotsel; Dialog colors
are: dnormal, dfocus, dhotnormal, dhotfocus; Help colors
are: helpnormal, helpitalic, helpbold, helplink,
helpslink; Viewer color is: viewunderline; Special highlighting mode:
executable, directory, link, device, special; Editor colors
are: helpnormal, helpitalic, helpbold, helplink, helpslink;
Viewer color is: viewunderline; Special highlighting colors are:
executable, directory, link, device, special, core; Editor colors
are: editnormal, editbold, editmarked.
<em/input/ determines the color of input lines used in query dialogs.
<em/gauge/ determines the color of the filled part of the progress bar
(gauge), which shows how many percent of files were copied
etc. in a graphical way.
The dialog boxes use the following colors: <em/dnormal/ is
used for the normal text, <em/dfocus/ is the color used for the
currently selected component, <em/dhotnormal/ is the color used
@ -2390,18 +2407,18 @@ normal text, <em/helpitalic/ is used for text which is
emphasized in italic in the manual page, <em/helpbold/ is used
for text which is emphasized in bold in the manual page,
<em/helplink/ is used for not selected hyperlinks and <em/helpslink/
is used for selected hyperlink.
is used for a selected hyperlink.
<em/gauge/ determines color of filled part of the progress bar
(gauge), which shows how many percent of files were copied
etc. in a graphical way.
For file type highlighting mode <em/directory/ specifies the color in
which directories are shown; <em/executable/ for executable files;
<em/link/ is used to represent links; <em/device/ - for character and
block devices; <em/special/ is for special files, such as FIFO and IPC
sockets; <em/core/ is for core files (see also the option <tt/highlight_mode/
at the section on <lnk name="special settings" id="Special Settings">).
Special highlight colors determine how files are displayed
when file highlighting is enabled (see the section on
<lnk name="Layout" id="Layout>).
<em/directory/ is used for directories or symbolic links to directories;
<em/executable/ for executable files;
<em/link/ is used for symbolic links which are neither stalled nor linked
to a directory; <em/stalledlink/ is used for stalled symbolic links;
<em/device/ - character and block devices;
<em/special/ is used for special files, such as FIFOs and IPC
sockets; <em/core/ is for core files.
The possible colors are: black, gray, red, brightred, green,
brightgreen, brown, yellow, blue, brightblue, magenta,
@ -2494,14 +2511,6 @@ similar behavior: Go down to the middle line, if over it;
else go to the bottom line unless you already are at the
bottom line, in such case it will move the selection to
the last file name in the panel.
<tag/highlight_mode/ By default all information on panels displayed with
the same color. If this variable is set to 1, then <em/perm/ or
<em/mode/ tokens in display format get ability to show access rights of the user
to the shown file. Appropriate triplet of reading, writing and execution rights
highlighted with the yellow (<tt/selected/) color. In addition, if the variable
is equal to <tt/2/, then all lines are displaying by the color according to
their type (see <lnk name="Colors" id="Colors">). Permissions highlighting
also works in this mode.
<tag/use_file_to_guess_type/ If this variable is on (the
default) it will spawn the file command to match the file
types listed on the <lnk name="mc.ext file" id="Extension File Edit">.

View File

@ -1,3 +1,8 @@
Tue Dec 29 16:55:24 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* gmain.c: According to the man page the color keyword for executable
files is `executable' and not `execute' -- changed.
1998-12-28 Jonathan Blandford <jrb@redhat.com>
* glayout.c: Initial rehash of the menu code.

View File

@ -26,7 +26,7 @@
GdkColorContext *mc_cc;
#define MAX_COLOR_PAIRS 32
#define MAX_COLOR_PAIRS 40
struct gmc_color_pairs_s gmc_color_pairs [MAX_COLOR_PAIRS];
char *default_edition_colors =
@ -38,6 +38,7 @@ char *default_edition_colors =
"marked=yellow,seagreen:"
"execute=slateblue:"
"link=green:"
"stalledlink=brightred:"
"device=magenta:"
"core=red:"
"menuhotsel=cyan,black:"

View File

@ -1,3 +1,36 @@
Tue Dec 29 16:34:02 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* file.c (progress_update_one): Ignore files in subdirectories
when panel totals haven't been computed.
(erase_dir, erase_file): update progress bar (i.e. make it work
for OP_DELETE).
(panel_operate_flags): Don't compute panel totals for OP_MOVE.
When moving files on the same filesystem computing totals might
last much longer than the actual move operation.
(various places): adpations for the above changes.
mon Dec 28 22:15:43 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* slint.c (try_alloc_color_pair): Changed hardcoded values into
defines.
Mon Dec 28 20:22:59 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* color.c, text.c: Added color "stalledlink" which is used for
stalled symbolic links. Formerly "viewunderline" was used for
this (IMO bad because function and name didn't match).
According to the man page the color keyword for executable files
is `executable' and not `execute' -- changed.
* color.c, color.h: When using SLang some color indexes are not
freely choosable (DEFAULT_COLOR clashed with A_BOLD_REVERSE).
Solved by adding holes in color_map.
* find.c (do_search): fixed possible memory leak
Sat Dec 26 09:53:39 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* layout.c: include sys/ioctl.h to get definition of TIOCGWINSZ

View File

@ -67,7 +67,7 @@ struct colorpair {
#endif
struct colorpair color_map [] = {
{ "normal=", 0, 0 }, /* normal */
{ "normal=", 0, 0 }, /* normal */ /* 1 */
{ "selected=", 0, 0 }, /* selected */
{ "marked=", 0, 0 }, /* marked */
{ "markselect=", 0, 0 }, /* marked/selected */
@ -76,35 +76,41 @@ struct colorpair color_map [] = {
{ "reverse=", 0, 0 }, /* reverse */
/* Dialog colors */
{ "dnormal=", 0, 0 }, /* Dialog normal */
{ "dnormal=", 0, 0 }, /* Dialog normal */ /* 8 */
{ "dfocus=", 0, 0 }, /* Dialog focused */
{ "dhotnormal=", 0, 0 }, /* Dialog normal/hot */
{ "dhotfocus=", 0, 0 }, /* Dialog focused/hot */
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view */
{ "menusel=", 0, 0 }, /* Menu selected color */
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view, underline in editor */
{ "menusel=", 0, 0 }, /* Menu selected color */ /* 13 */
{ "menuhot=", 0, 0 }, /* Color for menu hotkeys */
{ "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */
{ "helpnormal=", 0, 0 }, /* Help normal */
{ "helpnormal=", 0, 0 }, /* Help normal */ /* 16 */
{ "helpitalic=", 0, 0 }, /* Italic in help */
{ "helpbold=", 0, 0 }, /* Bold in help */
{ "helplink=", 0, 0 }, /* Not selected hyperlink */
{ "helpslink=", 0, 0 }, /* Selected hyperlink */
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) */
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) *//* 21 */
{ "input=", 0, 0 },
/* Per file types colors */
{ "directory=", 0, 0 },
{ "execute=", 0, 0 },
{ "link=", 0, 0 },
{ "directory=", 0, 0 }, /* 23 */
{ "executable=", 0, 0 },
{ "link=", 0, 0 }, /* symbolic link (neither stalled nor link to directory) */
{ "stalledlink=",0, 0 }, /* stalled symbolic link */
{ "device=", 0, 0 },
{ "special=", 0, 0 },
{ "core=", 0, 0 },
{ "special=", 0, 0 }, /* sockets, fifo */
{ "core=", 0, 0 }, /* core files */ /* 29 */
/* editor colors start at 29 */
{ "editnormal=", 0, 0 }, /* normal */
{ 0, 0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 30 */
{ 0, 0, 0 }, /* unused */
{ 0, 0, 0 }, /* not usable (A_REVERSE) */
{ 0, 0, 0 }, /* not usable (A_REVERSE_BOLD) */
/* editor colors start at 34 */
{ "editnormal=", 0, 0 }, /* normal */ /* 34 */
{ "editbold=", 0, 0 }, /* search->found */
{ "editmarked=", 0, 0 }, /* marked/selected */
};
@ -201,7 +207,11 @@ void configure_colors_string (char *the_color_string)
found = 0;
for (i = 0; i < ELEMENTS(color_map); i++){
int klen = strlen (color_map [i].name);
int klen;
if (!color_map [i].name)
continue;
klen = strlen (color_map [i].name);
if (strncmp (color_string, color_map [i].name, klen) == 0){
color_string += klen;
@ -232,7 +242,7 @@ static void configure_colors (void)
}
#ifndef HAVE_SLANG
#define MAX_PAIRS 30
#define MAX_PAIRS 34
int attr_pairs [MAX_PAIRS];
#endif
@ -253,8 +263,9 @@ init_colors (void)
use_colors = 1;
configure_colors ();
for (i = 0; i < ELEMENTS (color_map); i++)
init_pair (i+1, color_map_fg(i), color_map_bg(i));
for (i = 0; i < ELEMENTS (color_map); i++)
if (color_map [i].name)
init_pair (i+1, color_map_fg(i), color_map_bg(i));
load_dialog_colors ();
}
#else
@ -284,19 +295,22 @@ void init_colors (void)
#endif
#if defined HAVE_SLANG && !defined(OS2_NT)
if (use_colors) { /* Hack to make COLOR_PAIR(33) be the default fg/bg
of the terminal */
if (use_colors) { /* Hack to make COLOR_PAIR(DEFAULT_COLOR_INDEX)
be the default fg/bg of the terminal */
char *Norm_Vid = SLtt_tgetstr ("me");
if (Norm_Vid == NULL)
Norm_Vid = SLtt_tgetstr ("se");
if (Norm_Vid == NULL)
Norm_Vid = "\033[0m";
SLtt_set_color_esc (33, Norm_Vid);
SLtt_set_color_esc (DEFAULT_COLOR_INDEX, Norm_Vid);
}
#endif
for (i = 0; i < ELEMENTS (color_map); i++){
if (!color_map [i].name)
continue;
init_pair (i+1, color_map_fg(i), color_map_bg(i));
#ifndef HAVE_SLANG

View File

@ -22,9 +22,12 @@ extern int attr_pairs [];
#define PORT_COLOR(co,bw) (use_colors?co:bw)
#endif
/* Beware! When using Slang with color, not all the indexes are free.
See myslang.h (A_*) */
#define NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (1), 0))
#define SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR (2),A_REVERSE))
#define MARKED_COLOR (PORT_COLOR (MY_COLOR_PAIR (3),A_BOLD))
#ifdef HAVE_SLANG
#define MARKED_SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR (4),(SLtt_Use_Ansi_Colors ? A_BOLD_REVERSE : A_REVERSE | A_BOLD)))
#else
@ -33,22 +36,29 @@ extern int attr_pairs [];
#define ERROR_COLOR (PORT_COLOR (MY_COLOR_PAIR (5),0))
#define MENU_ENTRY_COLOR (PORT_COLOR (MY_COLOR_PAIR (6),A_REVERSE))
#define REVERSE_COLOR (PORT_COLOR (MY_COLOR_PAIR(7),A_REVERSE))
#define REVERSE_COLOR (PORT_COLOR (MY_COLOR_PAIR (7),A_REVERSE))
#define Q_SELECTED_COLOR (PORT_COLOR (SELECTED_COLOR, 0))
#define Q_UNSELECTED_COLOR REVERSE_COLOR
extern int sel_mark_color [4];
extern int dialog_colors [4];
/* Dialog colors */
#define COLOR_NORMAL (PORT_COLOR (MY_COLOR_PAIR (8),A_REVERSE))
#define COLOR_FOCUS (PORT_COLOR (MY_COLOR_PAIR (9),A_BOLD))
#define COLOR_HOT_NORMAL (PORT_COLOR (MY_COLOR_PAIR (10),0))
#define COLOR_HOT_FOCUS (PORT_COLOR (MY_COLOR_PAIR (11),0))
#define VIEW_UNDERLINED_COLOR (PORT_COLOR (MY_COLOR_PAIR(12),A_UNDERLINE))
#define MENU_SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR(13),A_BOLD))
#define MENU_HOT_COLOR (PORT_COLOR (MY_COLOR_PAIR(14),0))
#define MENU_HOTSEL_COLOR (PORT_COLOR (MY_COLOR_PAIR(15),0))
/*
* editor colors - only 3 for normal, search->found, and select, respectively
* Last is defined to view color.
*/
#define EDITOR_NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (29), 0))
#define EDITOR_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR (30),A_BOLD))
#define EDITOR_MARKED_COLOR (PORT_COLOR (MY_COLOR_PAIR (31),A_REVERSE))
#define EDITOR_UNDERLINED_COLOR VIEW_UNDERLINED_COLOR
#define HELP_NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR(16),A_REVERSE))
#define HELP_ITALIC_COLOR (PORT_COLOR (MY_COLOR_PAIR(17),A_REVERSE))
#define HELP_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR(18),A_REVERSE))
#define HELP_LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(19),0))
#define HELP_SLINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(20),A_BOLD))
/*
* This should be selectable independently. Default has to be black background
@ -57,34 +67,33 @@ extern int attr_pairs [];
#define GAUGE_COLOR (PORT_COLOR (MY_COLOR_PAIR(21),0))
#define INPUT_COLOR (PORT_COLOR (MY_COLOR_PAIR(22),0))
#ifdef HAVE_SLANG
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(33),0))
# else
# define DEFAULT_COLOR A_NORMAL
#endif
#define HELP_NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR(16),A_REVERSE))
#define HELP_ITALIC_COLOR (PORT_COLOR (MY_COLOR_PAIR(17),A_REVERSE))
#define HELP_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR(18),A_REVERSE))
#define HELP_LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(19),0))
#define HELP_SLINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(20),A_BOLD))
extern int sel_mark_color [4];
extern int dialog_colors [4];
#define COLOR_NORMAL (PORT_COLOR (MY_COLOR_PAIR (8),A_REVERSE))
#define COLOR_FOCUS (PORT_COLOR (MY_COLOR_PAIR (9),A_BOLD))
#define COLOR_HOT_NORMAL (PORT_COLOR (MY_COLOR_PAIR (10),0))
#define COLOR_HOT_FOCUS (PORT_COLOR (MY_COLOR_PAIR (11),0))
/* Add this to color panel, on BW all pairs are normal */
#define STALLED_COLOR (PORT_COLOR (MY_COLOR_PAIR (12),0))
#define DIRECTORY_COLOR (PORT_COLOR (MY_COLOR_PAIR (23),0))
#define EXECUTABLE_COLOR (PORT_COLOR (MY_COLOR_PAIR (24),0))
#define LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR (25),0))
#define DEVICE_COLOR (PORT_COLOR (MY_COLOR_PAIR (26),0))
#define SPECIAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (27),0))
#define CORE_COLOR (PORT_COLOR (MY_COLOR_PAIR (28),0))
#define STALLED_LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR (26),A_UNDERLINE))
#define DEVICE_COLOR (PORT_COLOR (MY_COLOR_PAIR (27),0))
#define SPECIAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (28),0))
#define CORE_COLOR (PORT_COLOR (MY_COLOR_PAIR (29),0))
#ifdef HAVE_SLANG
/* For the default color any unused index may be chosen. */
# define DEFAULT_COLOR_INDEX 30
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(DEFAULT_COLOR_INDEX),0))
# else
# define DEFAULT_COLOR A_NORMAL
#endif
/*
* editor colors - only 3 for normal, search->found, and select, respectively
* Last is defined to view color.
*/
#define EDITOR_NORMAL_COLOR_INDEX 34
#define EDITOR_NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (EDITOR_NORMAL_COLOR_INDEX), 0))
#define EDITOR_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR (35),A_BOLD))
#define EDITOR_MARKED_COLOR (PORT_COLOR (MY_COLOR_PAIR (36),A_REVERSE))
#define EDITOR_UNDERLINED_COLOR VIEW_UNDERLINED_COLOR
#endif /* __COLOR_H */

View File

@ -169,6 +169,7 @@ double file_progress_eta_secs;
int file_progress_do_reget = 1;
/* Status reporting flags */
int file_progress_totals_computed; /* panel total has been computed */
long file_progress_count;
double file_progress_bytes;
@ -230,8 +231,9 @@ char *op_names [3] = {
N_(" Delete ")
};
static int recursive_erase (char *s);
static int erase_file (char *s);
static int recursive_erase (char *s, long *progress_count, double *progress_bytes);
static int erase_file (char *s, long *progress_count,
double *progress_bytes, int is_toplevel_file);
/* }}} */
@ -517,12 +519,17 @@ make_symlink (char *src_path, char *dst_path)
}
static int
progress_update_one (long *progress_count, double *progress_bytes, int add)
progress_update_one (long *progress_count,
double *progress_bytes,
int add,
int is_toplevel_file)
{
int ret;
(*progress_count)++;
(*progress_bytes) += add;
if (is_toplevel_file || file_progress_totals_computed) {
(*progress_count)++;
(*progress_bytes) += add;
}
/* Apply some heuristic here to not call the update stuff very often */
ret = file_progress_show_count (*progress_count, file_progress_count);
@ -537,7 +544,8 @@ progress_update_one (long *progress_count, double *progress_bytes, int add)
int
copy_file_file (char *src_path, char *dst_path, int ask_overwrite,
long *progress_count, double *progress_bytes)
long *progress_count, double *progress_bytes,
int is_toplevel_file)
{
#ifndef OS2_NT
uid_t src_uid;
@ -892,7 +900,10 @@ ret:
}
if (return_status == FILE_CONT)
return_status = progress_update_one (progress_count, progress_bytes, file_size);
return_status = progress_update_one (
progress_count,
progress_bytes,
file_size, is_toplevel_file);
return return_status;
}
@ -1071,7 +1082,7 @@ copy_dir_dir (char *s, char *d, int toplevel,
dest_file = concat_dir_and_file (dest_dir, x_basename (path));
return_status = copy_file_file (
path, dest_file, 1,
progress_count, progress_bytes);
progress_count, progress_bytes, 0);
free (dest_file);
}
if (delete && return_status == FILE_CONT){
@ -1090,7 +1101,7 @@ copy_dir_dir (char *s, char *d, int toplevel,
if (S_ISDIR (buf.st_mode)){
return_status = erase_dir_iff_empty (path);
} else
return_status = erase_file (path);
return_status = erase_file (path, 0, 0, 0);
}
}
@ -1126,7 +1137,10 @@ ret:
/* {{{ Move routines */
int
move_file_file (char *s, char *d, long *progress_count, double *progress_bytes)
move_file_file (char *s,
char *d,
long *progress_count,
double *progress_bytes)
{
struct stat src_stats, dst_stats;
int return_status = FILE_CONT;
@ -1210,7 +1224,8 @@ move_file_file (char *s, char *d, long *progress_count, double *progress_bytes)
#endif
/* Failed because filesystem boundary -> copy the file instead */
return_status = copy_file_file (s, d, 0, progress_count, progress_bytes);
return_status = copy_file_file (s, d, 0,
progress_count, progress_bytes, 1);
if (return_status != FILE_CONT)
return return_status;
@ -1229,7 +1244,8 @@ move_file_file (char *s, char *d, long *progress_count, double *progress_bytes)
}
if (return_status == FILE_CONT)
return_status = progress_update_one (progress_count, progress_bytes, src_stats.st_size);
return_status = progress_update_one (progress_count,
progress_bytes, src_stats.st_size, 1);
return return_status;
}
@ -1319,7 +1335,7 @@ oktoret:
if (S_ISDIR (erase_list->st_mode)){
return_status = erase_dir_iff_empty (erase_list->name);
} else
return_status = erase_file (erase_list->name);
return_status = erase_file (erase_list->name, 0, 0, 0);
lp = erase_list;
erase_list = erase_list->next;
free (lp);
@ -1340,27 +1356,40 @@ oktoret:
/* }}} */
/* {{{ Erase routines */
/* Don't update progress status if progress_count==NULL */
static int
erase_file (char *s)
erase_file (char *s,
long *progress_count,
double *progress_bytes,
int is_toplevel_file)
{
int return_status;
struct stat buf;
if (file_progress_show_deleting (s) == FILE_ABORT)
return FILE_ABORT;
mc_refresh ();
if (progress_count && mc_stat (s, &buf)) {
/* ignore, most likely the mc_unlink fails, too */
buf.st_size = 0;
}
while (mc_unlink (s)){
return_status = file_error (_(" Cannot delete file \"%s\" \n %s "), s);
if (return_status != FILE_RETRY)
return return_status;
}
return FILE_CONT;
if (progress_count)
return progress_update_one (
progress_count, progress_bytes,
buf.st_size, is_toplevel_file);
else
return FILE_CONT;
}
static int
recursive_erase (char *s)
recursive_erase (char *s, long *progress_count, double *progress_bytes)
{
struct dirent *next;
struct stat buf;
@ -1387,9 +1416,10 @@ recursive_erase (char *s)
return 1;
}
if (S_ISDIR (buf.st_mode))
return_status = (recursive_erase (path) != FILE_CONT);
return_status = (recursive_erase (path, progress_count, progress_bytes) != FILE_CONT);
else
return_status = erase_file (path);
return_status = erase_file (
path, progress_count, progress_bytes, 0);
free (path);
/* .ado: OS/2 returns a block of memory DIR to next and must be freed */
#ifdef __os2__
@ -1439,7 +1469,7 @@ check_dir_is_empty(char *path)
}
int
erase_dir (char *s)
erase_dir (char *s, long *progress_count, double *progress_bytes)
{
int error;
@ -1464,7 +1494,7 @@ erase_dir (char *s)
if (error == 0){ /* not empty */
error = query_recursive (s);
if (error == FILE_CONT)
return recursive_erase (s);
return recursive_erase (s, progress_count, progress_bytes);
else
return error;
}
@ -1816,9 +1846,9 @@ panel_operate_flags (void *source_panel, FileOperation operation, char *thedefau
if (operation == OP_DELETE)
{
if (S_ISDIR (src_stat.st_mode))
value = erase_dir (source_with_path);
value = erase_dir (source_with_path, &count, &bytes);
else
value = erase_file (source_with_path);
value = erase_file (source_with_path, &count, &bytes, 1);
}
else
{
@ -1846,7 +1876,7 @@ panel_operate_flags (void *source_panel, FileOperation operation, char *thedefau
source_with_path, dest, 1, 0, 0, 0, &count, &bytes);
else
value = copy_file_file (
source_with_path, dest, 1, &count, &bytes);
source_with_path, dest, 1, &count, &bytes, 1);
break;
case OP_MOVE:
@ -1885,10 +1915,12 @@ panel_operate_flags (void *source_panel, FileOperation operation, char *thedefau
}
/* Initialize variables for progress bars */
if (verbose && file_op_compute_totals)
if (operation != OP_MOVE && verbose && file_op_compute_totals) {
panel_compute_totals (
panel, &file_progress_count, &file_progress_bytes);
else {
file_progress_totals_computed = 1;
} else {
file_progress_totals_computed = 0;
file_progress_count = panel->marked;
file_progress_bytes = panel->total;
}
@ -1926,9 +1958,9 @@ panel_operate_flags (void *source_panel, FileOperation operation, char *thedefau
if (operation == OP_DELETE){
if (S_ISDIR (src_stat.st_mode))
value = erase_dir (source_with_path);
value = erase_dir (source_with_path, &count, &bytes);
else
value = erase_file (source_with_path);
value = erase_file (source_with_path, &count, &bytes, 1);
}
else
{
@ -1955,7 +1987,7 @@ panel_operate_flags (void *source_panel, FileOperation operation, char *thedefau
else
value = copy_file_file (
source_with_path, temp, 1,
&count, &bytes);
&count, &bytes, 1);
free_linklist (&dest_dirs);
break;

View File

@ -31,7 +31,8 @@ extern int know_not_what_am_i_doing;
struct link;
int copy_file_file (char *s, char *d, int ask_overwrite,
long *progres_count, double *progress_bytes);
long *progres_count, double *progress_bytes,
int is_toplevel_file);
int move_file_file (char *s, char *d,
long *progres_count, double *progress_bytes);
int move_dir_dir (char *s, char *d,
@ -39,7 +40,7 @@ int move_dir_dir (char *s, char *d,
int copy_dir_dir (char *s, char *d, int toplevel, int move_over,
int delete, struct link *parent_dirs,
long *progres_count, double *progress_bytes);
int erase_dir (char *s);
int erase_dir (char *s, long *progres_count, double *progress_bytes);
int erase_dir_iff_empty (char *s);
/*

View File

@ -517,8 +517,12 @@ do_search (struct Dlg_head *h)
return;
}
if (find_ignore_dirs){
int found;
char *temp_dir = copy_strings (":", tmp, ":", 0);
if (strstr (find_ignore_dirs, temp_dir))
found = strstr (find_ignore_dirs, temp_dir) != 0;
free (temp_dir);
if (found)
free (tmp);
else
break;

View File

@ -1590,6 +1590,17 @@ panels. You can specify whether the area is split to the
panels in vertical or horizontal direction. The split can
be equal or you can specify an unequal split.
By default all contents of the directory panels are
displayed with the same color, but you can specify whether
permissions and file types are highlighted with special
Colors.Colors If permission highlighting is enabled, the parts
of the perm and mode display fieldsListing Mode... which are valid for
the user running Midnight Commander are highlighted with
the color defined with the selected keyword. If file type
highlighting is enabled, files are colored according to
their file type (e.g. directory, core file, executable,
...).
If the Show Mini-Status option is enabled, one line of
status information about the currently selected item is
showed at the bottom of the panels.
@ -2459,13 +2470,21 @@ The format for the color definition is:
<keyword>=<foregroundcolor>,<backgroundcolor>:<keyword>= ...
The colors are optional, and the keywords are: normal,
selected, marked, markselect, errors, input, reverse menu,
menusel, menuhot, menuhotsel, gauge; the dialog colors
are: dnormal, dfocus, dhotnormal, dhotfocus; Help colors
are: helpnormal, helpitalic, helpbold, helplink,
helpslink; Viewer color is: viewunderline; Special
highlighting mode: executable, directory, link, device,
special.
selected, marked, markselect, errors, input, reverse,
gauge; Menu colors are: menu, menusel, menuhot,
menuhotsel; Dialog colors are: dnormal, dfocus,
dhotnormal, dhotfocus; Help colors are: helpnormal,
helpitalic, helpbold, helplink, helpslink; Viewer color
is: viewunderline; Special highlighting colors are:
executable, directory, link, device, special, core; Editor
colors are: editnormal, editbold, editmarked.
input determines the color of input lines used in query
dialogs.
gauge determines the color of the filled part of the
progress bar (gauge), which shows how many percent of
files were copied etc. in a graphical way.
The dialog boxes use the following colors: dnormal is
used for the normal text, dfocus is the color used for the
@ -2484,17 +2503,15 @@ for text which is emphasized in bold in the manual page,
helplink is used for not selected hyperlinks and helpslink
is used for selected hyperlink.
gauge determines color of filled part of the progress bar
(gauge), which shows how many percent of files were copied
etc. in a graphical way.
For file type highlighting mode directory specifies the
color in which directories are shown; executable for
executable files; link is used to represent links; device
for character and block devices; special is for special
files, such as FIFO and IPC sockets; core is for core
files (see also the option highlight_mode at the section
on Special Settings).Special Settings
Special highlight colors determine how files are displayed
when file highlighting is enabled (see the section on
Layout).Layout directory is used for directories or symbolic
links to directories; executable for executable files;
link is used for symbolic links which are neither stalled
nor linked to a directory; stalledlink is used for stalled
symbolic links; device - character and block devices;
special is used for special files, such as FIFOs and IPC
sockets; core is for core files.
The possible colors are: black, gray, red, brightred,
green, brightgreen, brown, yellow, blue, brightblue,
@ -2596,16 +2613,6 @@ else go to the bottom line unless you already are at the
bottom line, in such case it will move the selection to
the last file name in the panel.
highlight_mode By default all information on panels
displayed with the same color. If this variable is set to
1, then perm or mode tokens in display format get ability
to show access rights of the user to the shown file.
Appropriate triplet of reading, writing and execution
rights highlighted with the yellow ( selected ) color. In
addition, if the variable is equal to 2, then all lines
are displaying by the color according to their type (see
Colors).Colors Permissions highlighting also works in this mode.
use_file_to_guess_type If this variable is on (the
default) it will spawn the file command to match the file
types listed on the mc.ext file.Extension File Edit

View File

@ -197,7 +197,7 @@ file_entry_color (file_entry *fe)
if (fe->f.link_to_dir)
return (DIRECTORY_COLOR);
else if (fe->f.stalled_link)
return (STALLED_COLOR);
return (STALLED_LINK_COLOR);
else
return (LINK_COLOR);
} else if (S_ISSOCK (fe->buf.st_mode))

View File

@ -384,7 +384,7 @@ try_alloc_color_pair (char *fg, char *bg)
0, 0, 0, 0
};
c.index = EDITOR_NORMAL_COLOR;
c.index = EDITOR_NORMAL_COLOR_INDEX;
p = &c;
for (;;) {
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
@ -400,9 +400,10 @@ try_alloc_color_pair (char *fg, char *bg)
p->fg = fg ? strdup (fg) : 0;
p->bg = bg ? strdup (bg) : 0;
if (!fg)
fg = color_map[28].fg;
/* Index in color_map array = COLOR_INDEX - 1 */
fg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
if (!bg)
bg = color_map[28].bg;
bg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].bg;
p->index = alloc_color_pair (fg, bg);
return p->index;
}

View File

@ -43,8 +43,9 @@ char *default_edition_colors =
"gauge=white,black:"
"input=black,cyan:"
"directory=white,blue:"
"execute=brightgreen,blue:"
"executable=brightgreen,blue:"
"link=lightgray,blue:"
"stalledlink=brightred,blue:"
"device=brightmagenta,blue:"
"core=red,blue:"
"special=black,blue:"