* cmd.c: Added single_dirsize_cmd(), which computes the size of

the currently selected panel entry and moves down. Suggested by
	ForestCreature on mc-devel.
	* cmd.h: Likewise.
	* main.c (midnight_callback): When the space key is pressed and
	the command line is empty, single_dirsize_cmd() is called.
This commit is contained in:
Roland Illig 2005-09-06 06:41:35 +00:00
parent e0898803a1
commit 0e218318da
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2005-09-06 Roland Illig <roland.illig@gmx.de>
* cmd.c: Added single_dirsize_cmd(), which computes the size of
the currently selected panel entry and moves down. Suggested by
ForestCreature on mc-devel.
* cmd.h: Likewise.
* main.c (midnight_callback): When the space key is pressed and
the command line is empty, single_dirsize_cmd() is called.
2005-09-05 Roland Illig <roland.illig@gmx.de>
* info.c: Switched from printw() to tty_printf() to avoid gcc

View File

@ -1173,6 +1173,29 @@ void quick_cd_cmd (void)
g_free (p);
}
void
single_dirsize_cmd (void)
{
WPanel *panel = current_panel;
file_entry *entry;
off_t marked;
double total;
entry = &(panel->dir.list[panel->selected]);
if (S_ISDIR (entry->st.st_mode) && strcmp(entry->fname, "..") != 0) {
total = 0.0;
compute_dir_size (entry->fname, &marked, &total);
entry->st.st_size = (off_t) total;
entry->f.dir_size_computed = 1;
}
if (mark_moves_down)
send_message (&(panel->widget), WIDGET_KEY, KEY_DOWN);
recalculate_panel_summary (panel);
panel->dirty = 1;
}
void
dirsizes_cmd (void)
{

View File

@ -7,6 +7,7 @@ void fishlink_cmd (void);
void smblink_cmd (void);
void undelete_cmd (void);
void help_cmd (void);
void single_dirsize_cmd (void);
void dirsizes_cmd (void);
int view_file_at_line (const char *filename, int plain_view, int internal,
int start_line);

View File

@ -1543,6 +1543,11 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
reverse_selection_cmd ();
return MSG_HANDLED;
}
if (parm == ' ') {
single_dirsize_cmd ();
return MSG_HANDLED;
}
}
}
return MSG_NOT_HANDLED;