tuit

toolbox pour des tui - retour accueil

git clone git://bebou.netlib.re/tuit

Log | Files | Refs |

commit 888448eb34d34eba3cbb64562308d22092af4bd5
parent 19ecebda943360bb8df02cc5c1657d92886557ef
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Wed, 11 Jun 2025 16:40:28 +0200

On continue l'ajout de la recherche

Le filtre sur un caractère fonctionne mais rien d'autre

Diffstat:
Mchoose.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/choose.c b/choose.c @@ -26,15 +26,20 @@ int main(int argc, char **argv) { tb_hide_cursor(); tb_set_input_mode(TB_INPUT_ESC | TB_INPUT_MOUSE); struct tb_event ev; - char buf[7]; + char buf[7]; buf[0]='\0'; while(1) { tb_clear(); + tb_printf(0,0,TB_DEFAULT,TB_DEFAULT,"> %s",buf); + int j=1; for (int i=0;i<min(tb_height(),count);i++) { - if (i+start==curelem) tb_printf(0,i,TB_BLACK,TB_WHITE,"> %s",list[i+start]); - else tb_printf(0,i,TB_DEFAULT,TB_DEFAULT," %s",list[i+start]); + if (!strchr(list[i+start],buf[0])) continue; + if (i+start==curelem) + tb_printf(0,j,TB_BLACK,TB_WHITE,"> %s",list[i+start]); + else + tb_printf(0,j,TB_DEFAULT,TB_DEFAULT," %s",list[i+start]); + j++; } - tb_printf(0,30,TB_DEFAULT,TB_DEFAULT,"blabla: %s",buf); tb_present(); tb_poll_event(&ev); switch(ev.type) {