From dd7c562c96060f95c609fa02574ef751c2ce5780 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 26 Jun 2018 18:30:38 +0200 Subject: [PATCH] lv_ddlist: fix the selection of options with non ASCII characters --- lv_objx/lv_ddlist.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 89e5e601d..a60ca725d 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -634,9 +634,12 @@ static lv_res_t lv_ddlist_release_action(lv_obj_t * ddlist) uint16_t new_opt = 0; const char * txt = lv_label_get_text(ext->label); - uint16_t i; - for(i = 0; i < letter_i; i++) { - if(txt[i] == '\n') new_opt ++; + uint32_t i = 0; + uint32_t line_cnt = 0; + uint32_t letter; + for(line_cnt = 0; line_cnt < letter_i; line_cnt++) { + letter = lv_txt_utf8_next(txt, &i); + if(letter == '\n') new_opt ++; } ext->sel_opt_id = new_opt;