sfm

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

commit bd4d66188dee66ff17c1a93ef9dcc4b2662c3035
parent 5eb7ea78ed6a386c70f06cf50b9f4f993cb0bf84
Author: afify <hassan@afify.dev>
Date:   Mon,  6 Jul 2020 06:12:15 +0300

[fix] ctrl+ u|d move top bottom if out of range

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

diff --git a/sfm.c b/sfm.c @@ -940,15 +940,17 @@ press(struct tb_event *ev, Pane *cpane, Pane *opane) cpane->hdir = (cpane->dirc/2); (void)listdir(cpane, NULL); } else if (ev->key == TB_KEY_CTRL_U) { - if (cpane->hdir > move_ud) { + if (cpane->hdir > move_ud) cpane->hdir = cpane->hdir - move_ud; - (void)listdir(cpane, NULL); - } + else + cpane->hdir = 1; + (void)listdir(cpane, NULL); } else if (ev->key == TB_KEY_CTRL_D) { - if (cpane->hdir < cpane->dirc - move_ud) { + if (cpane->hdir < cpane->dirc - move_ud) cpane->hdir = cpane->hdir + move_ud; - (void)listdir(cpane, NULL); - } + else + cpane->hdir = cpane->dirc; + (void)listdir(cpane, NULL); } else if (ev->ch == 'n') { char *user_input; user_input = ecalloc(MAX_USRI, sizeof(char));