cex

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

commit d1ce9afc4b77be5e0949bf48ef9afbdb7fc35520
parent eceabb0d17eea935edb73e930eaac3e8fff49159
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sat, 13 Jul 2024 19:39:20 +0200

array index fixes

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

diff --git a/cex.c b/cex.c @@ -1021,9 +1021,9 @@ next_search() if (searchc == 0) return; - for (size_t i = curwin.highlight+1; i < curwin.filecount; i++) { - if ((strstr(curwin.winfiles[i].d_name, searchq) != NULL)) { - curwin.highlight = i; + for (size_t i = curwin.highlight; i < curwin.filecount-1; i++) { + if ((strstr(curwin.winfiles[i+1].d_name, searchq) != NULL)) { + curwin.highlight = i+1; return; } } @@ -1037,9 +1037,9 @@ prev_search() if (searchc == 0) return; - for (size_t i = MAX(curwin.highlight-1, 0); i >= 0; i--) { - if ((strstr(curwin.winfiles[i].d_name, searchq) != NULL)) { - curwin.highlight = i; + for (size_t i = curwin.highlight; i > 0; i--) { + if ((strstr(curwin.winfiles[i-1].d_name, searchq) != NULL)) { + curwin.highlight = i-1; return; } }