cex

C/Curses file EXplorer
git clone git://git.wimdupont.com/cex.git
Log | Files | Refs | README | LICENSE

commit ae34bbcaedea9e7956766e58de7cd68d469e0d49
parent 690984c3a091cfb185c51898619306790f263bc6
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sat,  4 Oct 2025 18:34:00 +0200

smoother search select

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

diff --git a/cex.c b/cex.c @@ -79,6 +79,7 @@ static void move_page_up(DirWin *dirwin); static void move_page_down(DirWin *dirwin); static void move_up(DirWin *dirwin); static void move_down(DirWin *dirwin); +static void first_search(void); static void next_search(void); static void prev_search(void); static void free_dirwin(DirWin *dirwin); @@ -1087,6 +1088,7 @@ search(void) } break; } + first_search(); print_win(&curwin); } noecho(); @@ -1133,6 +1135,23 @@ move_down(DirWin *dirwin) } void +first_search(void) +{ + if (searchc == 0) + return; + + if (substr(NULL, curwin.winfiles[curwin.highlight].d_name, searchq, searchcs) != NULL) + return; + + for (int i = 0; i < MAX(curwin.filecount-1, 0); i++) { + if (substr(NULL, curwin.winfiles[i].d_name, searchq, searchcs) != NULL) { + curwin.highlight = i; + return; + } + } +} + +void next_search(void) { if (searchc == 0)