cex

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.wimdupont.com/cex.git
Log | Files | Refs | LICENSE

commit eceabb0d17eea935edb73e930eaac3e8fff49159
parent eac52812742e4760e9682a73dd430af68b9db75b
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sat, 13 Jul 2024 19:34:22 +0200

array index fixes

Diffstat:
Mcex.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cex.c b/cex.c @@ -181,11 +181,11 @@ start() update_child_win(); break; case KEY_VPUP: - if (is_dir(&parwin, parwin.highlight-1)) + if (is_dir(&parwin, MAX(parwin.highlight-1, 0))) change_parent_dir(UP); break; case KEY_VPDOWN: - if (is_dir(&parwin, parwin.highlight+1)) + if (is_dir(&parwin, MIN(parwin.highlight+1, parwin.filecount-1))) change_parent_dir(DOWN); break; case KEY_PPAGE: @@ -1037,7 +1037,7 @@ prev_search() if (searchc == 0) return; - for (size_t i = curwin.highlight-1; i > 0; i--) { + for (size_t i = MAX(curwin.highlight-1, 0); i >= 0; i--) { if ((strstr(curwin.winfiles[i].d_name, searchq) != NULL)) { curwin.highlight = i; return;