sfm

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

commit 26e53f038047df7ed3a420b7783d75757d55a3ac
parent de7271a3c6f5bd7ed5ccd7abe6100ef8499cd887
Author: afify <hassan@afify.dev>
Date:   Tue, 13 Oct 2020 07:08:35 +0300

[fix] resize empty dir status and highlight

- problem 1: resize() with empty directory, add highlight to unexisted
  row (row 1).
- problem 2: resize() call refresh_pane() twice, status for empty dir
  exists.
- solution: if dirc > 0 add highlight, if dirc not > 0 clear_status()

Diffstat:
Msfm.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sfm.c b/sfm.c @@ -1514,7 +1514,10 @@ refresh_pane(void) y++; } - print_info(); + if (cpane->dirc > 0) + print_info(); + else + clear_status(); /* print current directory title */ cpane->dircol.fg |= TB_BOLD; @@ -1650,7 +1653,8 @@ t_resize(void) chdir(pane_l.dirn); cpane = &pane_l; refresh_pane(); - add_hi(&pane_l, pane_l.hdir - 1); + if (cpane->dirc > 0) + add_hi(&pane_l, pane_l.hdir - 1); } else if (cpane == &pane_r) { chdir(pane_l.dirn); cpane = &pane_l; @@ -1658,7 +1662,8 @@ t_resize(void) chdir(pane_r.dirn); cpane = &pane_r; refresh_pane(); - add_hi(&pane_r, pane_r.hdir - 1); + if (cpane->dirc > 0) + add_hi(&pane_r, pane_r.hdir - 1); } tb_present();