(edit_execute_cmd): refactor loop.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-10-28 10:16:01 +03:00
parent 442af62c07
commit c3bc294bb3

View File

@ -3381,7 +3381,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
&& !mc_global.utf8_display) && !mc_global.utf8_display)
{ {
unsigned char str[UTF8_CHAR_LEN + 1]; unsigned char str[UTF8_CHAR_LEN + 1];
size_t i = 0; size_t i;
int res; int res;
res = g_unichar_to_utf8 (char_for_insertion, (char *) str); 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'; 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]; char_for_insertion = str[i];
edit_insert (edit, char_for_insertion); edit_insert (edit, char_for_insertion);
i++;
} }
} }
else else