sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit a9ff67e719fbef834782fa3682b68b4d359463d2
parent d19002b02b69fcff0cda7c9a61b799f0cfe15a83
Author: mohamedafify <mohamed@afify.dev>
Date:   Tue, 14 Jul 2020 16:14:33 +0200

[fix] show all file info when (x) if dir

Diffstat:
Msfm.c | 20++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/sfm.c b/sfm.c @@ -1095,12 +1095,20 @@ indir_press(struct tb_event *ev, Pane *cpane) cpane->hdir = (cpane->dirc/2); refresh_pane(cpane); } else if (ev->ch == 'x') { - off_t *fullsize = ecalloc(50, sizeof(off_t)); - get_dir_size(cpane->direntr[cpane->hdir-1].name, fullsize); - char *csize = get_file_size(*fullsize); - print_status(status_f, status_b, "%s", csize); - free(fullsize); - free(csize); + if (S_ISDIR(cpane->direntr[cpane->hdir-1].mode)) { + off_t *fullsize = ecalloc(50, sizeof(off_t)); + get_dir_size(cpane->direntr[cpane->hdir-1].name, fullsize); + char *csize = get_file_size(*fullsize); + char *result = get_file_info(&cpane->direntr[cpane->hdir-1]); + clear_status(); + print_status(status_f, status_b, "%lu/%lu %s%s", + cpane->hdir, + cpane->dirc, + result, csize); + free(csize); + free(fullsize); + free(result); + } } else if (ev->key == TB_KEY_CTRL_U) { if (cpane->hdir > move_ud) cpane->hdir = cpane->hdir - move_ud;