Fixed display info about ".." directory in Info panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-10-31 23:04:35 +03:00
parent 7ce24c2f57
commit b39b23a627

View File

@ -70,7 +70,7 @@ static void info_box (Dlg_head *h, struct WInfo *info)
static void static void
info_show_info (struct WInfo *info) info_show_info (struct WInfo *info)
{ {
static int i18n_adjust=0; static int i18n_adjust = 0;
static const char *file_label; static const char *file_label;
GString *buff; GString *buff;
struct stat st; struct stat st;
@ -96,10 +96,10 @@ info_show_info (struct WInfo *info)
/* Print only lines which fit */ /* Print only lines which fit */
if(!i18n_adjust) { if (i18n_adjust == 0) {
/* This printf pattern string is used as a reference for size */ /* This printf pattern string is used as a reference for size */
file_label=_("File: %s"); file_label = _("File: %s");
i18n_adjust = str_term_width1(file_label) + 2; i18n_adjust = str_term_width1 (file_label) + 2;
} }
buff = g_string_new (""); buff = g_string_new ("");
@ -193,30 +193,30 @@ info_show_info (struct WInfo *info)
tty_printf (_("Owner: %s/%s"), tty_printf (_("Owner: %s/%s"),
get_owner (st.st_uid), get_owner (st.st_uid),
get_group (st.st_gid)); get_group (st.st_gid));
case 6: case 6:
widget_move (&info->widget, 6, 3); widget_move (&info->widget, 6, 3);
tty_printf (_("Links: %d"), (int) st.st_nlink); tty_printf (_("Links: %d"), (int) st.st_nlink);
case 5: case 5:
widget_move (&info->widget, 5, 3); widget_move (&info->widget, 5, 3);
tty_printf (_("Mode: %s (%04o)"), tty_printf (_("Mode: %s (%04o)"),
string_perm (st.st_mode), (unsigned) st.st_mode & 07777); string_perm (st.st_mode), (unsigned) st.st_mode & 07777);
case 4: case 4:
widget_move (&info->widget, 4, 3); widget_move (&info->widget, 4, 3);
tty_printf (_("Location: %Xh:%Xh"), (int)st.st_dev, (int)st.st_ino); tty_printf (_("Location: %Xh:%Xh"), (int)st.st_dev, (int)st.st_ino);
case 3: case 3:
{
const char *fname;
widget_move (&info->widget, 3, 2); widget_move (&info->widget, 3, 2);
/* .ado: fname is invalid if selected == 0 && info called from current panel */ fname = current_panel->dir.list [current_panel->selected].fname;
if (current_panel->selected){ str_printf (buff, file_label,
str_printf (buff, file_label, str_trunc (fname, info->widget.cols - i18n_adjust));
str_trunc (current_panel->dir.list [current_panel->selected].fname, tty_print_string (buff->str);
info->widget.cols - i18n_adjust)); }
tty_print_string (buff->str);
} else
tty_print_string (_("File: None"));
case 2: case 2:
case 1: case 1:
@ -230,13 +230,13 @@ static void info_hook (void *data)
{ {
struct WInfo *info = (struct WInfo *) data; struct WInfo *info = (struct WInfo *) data;
Widget *other_widget; Widget *other_widget;
other_widget = get_panel_widget (get_current_index ()); other_widget = get_panel_widget (get_current_index ());
if (!other_widget) if (!other_widget)
return; return;
if (dlg_overlap (&info->widget, other_widget)) if (dlg_overlap (&info->widget, other_widget))
return; return;
info->ready = 1; info->ready = 1;
info_show_info (info); info_show_info (info);
} }
@ -301,4 +301,3 @@ info_new (void)
return info; return info;
} }