Simplify osk_update_last_codepoint()

This commit is contained in:
twinaphex 2021-09-12 17:36:22 +02:00
parent 3d303a63df
commit ad39b1d115

View File

@ -7586,6 +7586,13 @@ static void osk_update_last_codepoint(
const char *letter = word; const char *letter = word;
const char *pos = letter; const char *pos = letter;
if (word[0] == 0)
{
*last_codepoint = 0;
*last_codepoint_len = 0;
return;
}
for (;;) for (;;)
{ {
unsigned codepoint = utf8_walk(&letter); unsigned codepoint = utf8_walk(&letter);
@ -7859,16 +7866,10 @@ bool menu_input_dialog_get_display_kb(void)
input_keyboard_line_append(&p_rarch->keyboard_line, word); input_keyboard_line_append(&p_rarch->keyboard_line, word);
if (word[0] == 0) osk_update_last_codepoint(
{ &p_rarch->osk_last_codepoint,
p_rarch->osk_last_codepoint = 0; &p_rarch->osk_last_codepoint_len,
p_rarch->osk_last_codepoint_len = 0; word);
}
else
osk_update_last_codepoint(
&p_rarch->osk_last_codepoint,
&p_rarch->osk_last_codepoint_len,
word);
buf[i+1] = oldchar; buf[i+1] = oldchar;
} }
} }
@ -19134,16 +19135,10 @@ static void input_event_osk_append(
else else
{ {
input_keyboard_line_append(&p_rarch->keyboard_line, word); input_keyboard_line_append(&p_rarch->keyboard_line, word);
if (word[0] == 0) osk_update_last_codepoint(
{ &p_rarch->osk_last_codepoint,
p_rarch->osk_last_codepoint = 0; &p_rarch->osk_last_codepoint_len,
p_rarch->osk_last_codepoint_len = 0; word);
}
else
osk_update_last_codepoint(
&p_rarch->osk_last_codepoint,
&p_rarch->osk_last_codepoint_len,
word);
} }
} }
@ -20692,20 +20687,12 @@ static bool input_keyboard_line_event(
word = array; word = array;
} }
/* OSK - update last character */
if (word) if (word)
{ osk_update_last_codepoint(
/* OSK - update last character */ &p_rarch->osk_last_codepoint,
if (word[0] == 0) &p_rarch->osk_last_codepoint_len,
{ word);
p_rarch->osk_last_codepoint = 0;
p_rarch->osk_last_codepoint_len = 0;
}
else
osk_update_last_codepoint(
&p_rarch->osk_last_codepoint,
&p_rarch->osk_last_codepoint_len,
word);
}
return ret; return ret;
} }