tuit

toolbox pour des tui - retour accueil

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

Log | Files | Refs |

commit 36be2d51dd97358f771c7284a8fb0d78aee71695
parent b1712fbb7112f836b7836503e9396ecff1f5eab7
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Mon,  9 Jun 2025 23:25:08 +0200

Correction bug pagedown petites listes

Si la liste est plus petite que la hauteur de la fenĂȘtre pagedown
faisait un segfault.

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

diff --git a/choose.c b/choose.c @@ -17,9 +17,7 @@ int main(int argc, char **argv) { tb_set_input_mode(TB_INPUT_ESC | TB_INPUT_MOUSE); struct tb_event ev; - int curelem=0; - int count=0; - int start=0; + int curelem=0; int count=0; int start=0; char line[CARD_NAME_SIZE]; char **list; @@ -75,7 +73,7 @@ int main(int argc, char **argv) { start=start+tb_height(); curelem=curelem+tb_height(); } else { - start=count-tb_height(); + start=max(0,count-tb_height()); curelem=count-1; } break;