mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
add arabic processin to to window title and lv_dropdown_add_option
This commit is contained in:
parent
cb021a425a
commit
243145d8c9
@ -9,6 +9,8 @@
|
||||
|
||||
### Bugfixes
|
||||
- fix(draw_rect) free buffer used for arabic processing
|
||||
- fix(win) arabic process the title of the window
|
||||
- fix(dropdown) arabic process the option in lv_dropdown_add_option
|
||||
|
||||
## v7.8.1 (Plannad at 15.12.2020)
|
||||
|
||||
|
@ -303,7 +303,12 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos
|
||||
|
||||
/*Allocate space for the new option*/
|
||||
size_t old_len = (ext->options == NULL) ? 0 : strlen(ext->options);
|
||||
size_t ins_len = strlen(option);
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
size_t ins_len = strlen(option) + 1;
|
||||
#else
|
||||
size_t ins_len = _lv_txt_ap_calc_bytes_cnt(option) + 1;
|
||||
#endif
|
||||
|
||||
size_t new_len = ins_len + old_len + 2; /* +2 for terminating NULL and possible \n */
|
||||
ext->options = lv_mem_realloc(ext->options, new_len + 1);
|
||||
LV_ASSERT_MEM(ext->options);
|
||||
@ -331,9 +336,13 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos
|
||||
char * ins_buf = _lv_mem_buf_get(ins_len + 2); /* + 2 for terminating NULL and possible \n */
|
||||
LV_ASSERT_MEM(ins_buf);
|
||||
if(ins_buf == NULL) return;
|
||||
strcpy(ins_buf, option);
|
||||
if(pos < ext->option_cnt)
|
||||
strcat(ins_buf, "\n");
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
strcpy(ins_buf, options);
|
||||
#else
|
||||
_lv_txt_ap_proc(option, ins_buf);
|
||||
#endif
|
||||
if(pos < ext->option_cnt) strcat(ins_buf, "\n");
|
||||
|
||||
_lv_txt_ins(ext->options, _lv_txt_encoded_get_char_id(ext->options, insert_pos), ins_buf);
|
||||
_lv_mem_buf_release(ins_buf);
|
||||
|
||||
|
@ -258,11 +258,20 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
|
||||
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
ext->title_txt = lv_mem_realloc(ext->title_txt, strlen(title) + 1);
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
size_t len = strlen(title) + 1;
|
||||
#else
|
||||
size_t len = _lv_txt_ap_calc_bytes_cnt(title) + 1;
|
||||
#endif
|
||||
|
||||
ext->title_txt = lv_mem_realloc(ext->title_txt, len + 1);
|
||||
LV_ASSERT_MEM(ext->title_txt);
|
||||
if(ext->title_txt == NULL) return;
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
|
||||
strcpy(ext->title_txt, title);
|
||||
#else
|
||||
_lv_txt_ap_proc(title, ext->title_txt);
|
||||
#endif
|
||||
lv_obj_invalidate(ext->header);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user