From 6e0527e4a1e7ff8f131fe2a7a67191943b220e33 Mon Sep 17 00:00:00 2001 From: Verdant Date: Sun, 17 May 2026 20:12:23 +0800 Subject: fix: solve line-wrapping and duplication during key repeat --- main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 77ef0a7..e29f192 100644 --- a/main.c +++ b/main.c @@ -225,7 +225,7 @@ void enable_term_echo() { void print_pure(struct input_event * ie) { if (repeat_counters[ie -> code] != 1) { - printf("\r%-15s x%-13d", key_names[ie -> code], repeat_counters[ie -> code]); + printf("%-15s x%-13d\r", key_names[ie -> code], repeat_counters[ie -> code]); } else { printf("%s", key_names[ie -> code]); } @@ -299,14 +299,13 @@ int main(int argc, char ** argv) { } if (ie.value == KEY_REPEAT) { + if (cfg->enable_time) { + if (cfg->enable_time) printf("\r\033[K"); + } line_lock = ie.code; repeat_counters[ie.code]++; fp(&ie); } - - if (ie.value == KEY_RELEASE) { - repeat_counters[ie.code] = 1; - } } } -- cgit v1.2.3