From c3bc294bb392aabeef9836a68b1c719bd16e9527 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 28 Oct 2023 10:16:01 +0300 Subject: [PATCH] (edit_execute_cmd): refactor loop. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index fb6a4ab57..708288d63 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3381,7 +3381,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) && !mc_global.utf8_display) { unsigned char str[UTF8_CHAR_LEN + 1]; - size_t i = 0; + size_t i; int res; res = g_unichar_to_utf8 (char_for_insertion, (char *) str); @@ -3394,11 +3394,10 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) { str[res] = '\0'; } - while (i <= UTF8_CHAR_LEN && str[i] != '\0') + for (i = 0; i <= UTF8_CHAR_LEN && str[i] != '\0'; i++) { char_for_insertion = str[i]; edit_insert (edit, char_for_insertion); - i++; } } else