From 37d82bebf8a9dc3cc035c0520249ffce214d83f0 Mon Sep 17 00:00:00 2001 From: nova Date: Tue, 12 Aug 2025 22:35:31 +0200 Subject: [PATCH] fixed N repetitions of movenment keys --- interactions.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/interactions.c b/interactions.c index 2385fdc..b67b789 100644 --- a/interactions.c +++ b/interactions.c @@ -77,16 +77,15 @@ void user_interactions() { memset(input, 0, 255); input_pass = 0; timeout(100); /* blocking timeout of getch() */ - status |= STATUS_UPDATE_SCREEN_0; } binding_pass = 0; - status |= STATUS_UPDATE_SCREEN_0; + status |= STATUS_UPDATE_SCREEN_0; } void (*func_ptr)(int, int); - int number_length = 0; + unsigned long number_length = 0; if (!binding_pass) { parsed_input_number = 0; @@ -94,7 +93,6 @@ void user_interactions() { parsed_input_number = (parsed_input_number * 10) + (*input - '0'); input++; number_length++; - mvaddch(terminal_height-5, 5, number_length+48); } input -= number_length; binding_pass = 1; @@ -109,11 +107,7 @@ void user_interactions() { func_ptr = key_binding[i].func; func_ptr(parsed_input_number, i); - refresh(); - curs_set(0); - refresh(); - - } else if (strncmp(input+number_length, key_binding[i].key, cmp_len) == 0) { + } else if (strncmp(input + number_length, key_binding[i].key, cmp_len) == 0) { binding_matches++; mvwprintw(stdscr, terminal_height-binding_matches-1, 0, "\t\t\t"); mvwprintw(stdscr, terminal_height-binding_matches-1, 0, "%s\t%s", key_binding[i].key, key_binding[i].comment); @@ -125,7 +119,7 @@ void user_interactions() { mvaddstr(terminal_height-binding_matches-2, 0, "input\tcommand\t\t"); attroff(A_UNDERLINE); status &= ~STATUS_INPUT_MATCH; - } else { + } else if (number_length != strlen(input)) { memset(input, 0, 255); input_pass = 0; binding_pass = 0;