tuit

toolbox pour des tui - retour accueil

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

Log | Files | Refs |

commit 6a8651f8452cf3f4cdb473eb42829d789b75b8d2
parent d04c03a7c523fbe85a522c5989c31e378b276abc
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 12 Jun 2025 22:28:09 +0200

j -> filteredcount

Diffstat:
Mchoose.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/choose.c b/choose.c @@ -31,6 +31,7 @@ int main(int argc, char **argv) { signed int filtered[allcount+1]; filtered[allcount]=-1; for (int i=0;i<allcount;i++) filtered[i]=i; + int filteredcount=allcount; while(1) { tb_clear(); @@ -87,10 +88,13 @@ int main(int argc, char **argv) { break; case 0: buf[tb_utf8_unicode_to_char(buf, ev.ch)] = '\0'; - start=0; int j=0; + start=0; filteredcount=0; for (int i=0;i<allcount;i++) - if (strchr(all[i],buf[0])) { filtered[j]=i; j++; } - filtered[j]=-1; + if (strchr(all[i],buf[0])) { + filtered[filteredcount]=i; + filteredcount++; + } + filtered[filteredcount]=-1; curline=2; curelem=filtered[0]; default: