1
1

Mon Mar 22 02:05:28 1999 Timur Bakeyev <mc@bat.ru>

* screen.c (file_entry_color): Dropped. Code went to file_compute_color.

	* screen (format_file): Add check, that avoids reported error, when
	long file list -> quick view -> brief file list gives core dump.
Этот коммит содержится в:
Timur Bakeyev 1999-03-21 23:05:17 +00:00
родитель 4504f6153c
Коммит 112483442a
2 изменённых файлов: 56 добавлений и 55 удалений

Просмотреть файл

@ -1,9 +1,17 @@
Mon Mar 22 02:05:28 1999 Timur Bakeyev <mc@bat.ru>
* screen.c (file_entry_color): Dropped. Code went to file_compute_color.
* screen (format_file): Add check, that avoids reported error, when
long file list -> quick view -> brief file list gives core dump.
1999-03-19 Jonathan Blandford <jrb@redhat.com> 1999-03-19 Jonathan Blandford <jrb@redhat.com>
* main.c (main): We don't want to restart if we hit cancel. * main.c (main): We don't want to restart if we hit cancel.
* file.c (panel_operate): Ugly hack for GNOME. We only treat the * file.c (panel_operate): Ugly hack for GNOME. We only treat the
copy as if it were many files, and skip the only_one branch. copy as if it were many files, and skip the only_one branch.
1999-03-18 Miguel de Icaza <miguel@nuclecu.unam.mx> 1999-03-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
* utilunix.c (close_error_pipe): Inform parent of the return value * utilunix.c (close_error_pipe): Inform parent of the return value
@ -12,8 +20,8 @@
Thu Mar 18 16:09:09 1999 Timur Bakeyev <mc@bat.ru> Thu Mar 18 16:09:09 1999 Timur Bakeyev <mc@bat.ru>
* panel.h, screen.c: Add an ability to center justify fields in * panel.h, screen.c: Add an ability to center justify fields in the
panel, in addition to left and right justificatin. Just for fun. panel, in addition to left and right justification. Just for fun.
Try =name in user format. Try =name in user format.
* util.c (name_quote): Quote "~@^|;:". Hope, that's all :) * util.c (name_quote): Quote "~@^|;:". Hope, that's all :)

Просмотреть файл

@ -12,7 +12,7 @@
GNU General Public License for more details. GNU General Public License for more details.
Written by: 1995 Miguel de Icaza Written by: 1995 Miguel de Icaza
1997 Timur Bakeyev 1997, 1999 Timur Bakeyev
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -73,7 +73,6 @@ int permission_mode = 0;
/* If 1 - then add per file type hilighting */ /* If 1 - then add per file type hilighting */
int filetype_mode = 1; int filetype_mode = 1;
/* This gives abilitiy to determine colored user priveleges */ /* This gives abilitiy to determine colored user priveleges */
extern user_in_groups *current_user_gid; extern user_in_groups *current_user_gid;
extern uid_t current_user_uid; extern uid_t current_user_uid;
@ -181,35 +180,6 @@ add_permission_string (char *dest, int width, file_entry *fe, int attr, int colo
} }
#endif /* HAVE_X */ #endif /* HAVE_X */
int
file_entry_color (file_entry *fe)
{
if (filetype_mode){
if (S_ISDIR (fe->buf.st_mode))
return (DIRECTORY_COLOR);
else if (S_ISLNK (fe->buf.st_mode)) {
if (fe->f.link_to_dir)
return (DIRECTORY_COLOR);
else if (fe->f.stalled_link)
return (STALLED_LINK_COLOR);
else
return (LINK_COLOR);
} else if (S_ISSOCK (fe->buf.st_mode))
return (SPECIAL_COLOR);
else if (S_ISCHR (fe->buf.st_mode))
return (DEVICE_COLOR);
else if (S_ISBLK (fe->buf.st_mode))
return (DEVICE_COLOR);
else if (S_ISFIFO (fe->buf.st_mode))
return (SPECIAL_COLOR);
else if (is_exe (fe->buf.st_mode))
return (EXECUTABLE_COLOR);
else if (fe->fname && (!strcmp (fe->fname, "core") || !strcmp (extension(fe->fname), "core")))
return (CORE_COLOR);
}
return (NORMAL_COLOR);
}
/* String representations of various file attributes */ /* String representations of various file attributes */
/* name */ /* name */
char * char *
@ -289,7 +259,7 @@ string_file_type (file_entry *fe, int len)
buffer [0] = '*'; buffer [0] = '*';
else else
buffer [0] = ' '; buffer [0] = ' ';
buffer [1] = 0; buffer [1] = '\0';
return buffer; return buffer;
} }
@ -448,9 +418,10 @@ to_buffer (char *dest, int just_mode, int len, char *txt)
{ {
int txtlen = strlen (txt); int txtlen = strlen (txt);
int still, over; int still, over;
memset (dest, ' ', len);
/* Fill buffer with spaces */
memset (dest, ' ', len);
still = (over=(txtlen > len)) ? (txtlen - len) : (len - txtlen); still = (over=(txtlen > len)) ? (txtlen - len) : (len - txtlen);
switch (HIDE_FIT(just_mode)){ switch (HIDE_FIT(just_mode)){
@ -481,26 +452,45 @@ to_buffer (char *dest, int just_mode, int len, char *txt)
int int
file_compute_color (int attr, file_entry *fe) file_compute_color (int attr, file_entry *fe)
{ {
int color;
switch (attr){ switch (attr){
case SELECTED: case SELECTED:
color = SELECTED_COLOR; return (SELECTED_COLOR);
break;
case MARKED: case MARKED:
color = MARKED_COLOR; return (MARKED_COLOR);
break;
case MARKED_SELECTED: case MARKED_SELECTED:
color = MARKED_SELECTED_COLOR; return (MARKED_SELECTED_COLOR);
break;
case STATUS: case STATUS:
color = NORMAL_COLOR; return (NORMAL_COLOR);
break;
case NORMAL: case NORMAL:
default: default:
color = file_entry_color(fe); if (!filetype_mode)
return (NORMAL_COLOR);
} }
return color;
/* if filetype_mode == true */
if (S_ISDIR (fe->buf.st_mode))
return (DIRECTORY_COLOR);
else if (S_ISLNK (fe->buf.st_mode)){
if (fe->f.link_to_dir)
return (DIRECTORY_COLOR);
else if (fe->f.stalled_link)
return (STALLED_LINK_COLOR);
else
return (LINK_COLOR);
} else if (S_ISSOCK (fe->buf.st_mode))
return (SPECIAL_COLOR);
else if (S_ISCHR (fe->buf.st_mode))
return (DEVICE_COLOR);
else if (S_ISBLK (fe->buf.st_mode))
return (DEVICE_COLOR);
else if (S_ISFIFO (fe->buf.st_mode))
return (SPECIAL_COLOR);
else if (is_exe (fe->buf.st_mode))
return (EXECUTABLE_COLOR);
else if (fe->fname && (!strcmp (fe->fname, "core") || !strcmp (extension(fe->fname), "core")))
return (CORE_COLOR);
return (NORMAL_COLOR); /* just for safeness */
} }
/* Formats the file number file_index of panel in the buffer dest */ /* Formats the file number file_index of panel in the buffer dest */
@ -523,7 +513,12 @@ format_file (char *dest, WPanel *panel, int file_index, int width, int attr, int
color = file_compute_color (attr, fe); color = file_compute_color (attr, fe);
else else
color = NORMAL_COLOR; color = NORMAL_COLOR;
for (format = home; format; format = format->next){ for (format = home; format; format = format->next){
if (length == width)
break;
if (format->string_fn){ if (format->string_fn){
int len; int len;
@ -540,10 +535,7 @@ format_file (char *dest, WPanel *panel, int file_index, int width, int attr, int
cdest = to_buffer (cdest, format->just_mode, len, txt); cdest = to_buffer (cdest, format->just_mode, len, txt);
length += len; length += len;
#ifdef HAVE_X #ifndef HAVE_X
if (length == width)
break;
#else
attrset (color); attrset (color);
if (permission_mode && !strcmp(format->id, "perm")) if (permission_mode && !strcmp(format->id, "perm"))
@ -552,6 +544,7 @@ format_file (char *dest, WPanel *panel, int file_index, int width, int attr, int
add_permission_string (old_pos, format->field_len, fe, attr, color, 1); add_permission_string (old_pos, format->field_len, fe, attr, color, 1);
else else
addstr (old_pos); addstr (old_pos);
#endif #endif
} else { } else {
#ifndef HAVE_X #ifndef HAVE_X
@ -572,7 +565,7 @@ format_file (char *dest, WPanel *panel, int file_index, int width, int attr, int
while (still--) while (still--)
#ifdef HAVE_X #ifdef HAVE_X
*cdest++ = ' '; *cdest++ = ' ';
*cdest = 0; *cdest = '\0';
#else #else
addch (' '); addch (' ');
#endif #endif
@ -899,7 +892,7 @@ panel_save_name (WPanel *panel)
/* If the program is shuting down */ /* If the program is shuting down */
if ((midnight_shutdown && auto_save_setup) || saving_setup) if ((midnight_shutdown && auto_save_setup) || saving_setup)
return g_strconcat (panel->panel_name, NULL); return g_strdup (panel->panel_name);
else else
return g_strconcat ("Temporal:", panel->panel_name, NULL); return g_strconcat ("Temporal:", panel->panel_name, NULL);
} }
@ -1181,7 +1174,7 @@ parse_panel_size (WPanel *panel, char *format, int isstatus)
| format , one_format_e | format , one_format_e
one_format_e := just format.id [opt_size] one_format_e := just format.id [opt_size]
just := [<|>] just := [<=>]
opt_size := : size [opt_expand] opt_size := : size [opt_expand]
size := [0-9]+ size := [0-9]+
opt_expand := + opt_expand := +