sfm

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

commit c6ffa20e41c4bc6e58dd91780cc41eec89cb6fa6
parent c12db64edd1721d56dafb4353be4abf6d8d42c6a
Author: afify <hassan@afify.dev>
Date:   Tue, 25 May 2021 17:32:33 +0300

[fix] highlight row after dir changes

- listdir() will set hdir if dirc changes

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

diff --git a/sfm.c b/sfm.c @@ -685,9 +685,6 @@ delent(void) print_error(strerror(errno)); return; } - - if (BETWEEN(cpane->hdir - 1, 1, cpane->dirc)) /* last entry */ - cpane->hdir--; } static void @@ -1790,12 +1787,11 @@ listdir(Pane *pane) qsort(pane->direntr, pane->dirc, sizeof(Entry), sort_name); refresh_pane(pane); - if (pane == cpane) { - if (pane->hdir >= pane->dirc) - add_hi(pane, pane->dirc); - else + if (pane->hdir > pane->dirc) + pane->hdir = pane->dirc; + + if (pane == cpane) add_hi(pane, pane->hdir - 1); - } if (closedir(dir) < 0) return -1;