merge master

This commit is contained in:
Gabor Kiss-Vamosi
2020-12-28 13:08:26 +01:00
32 changed files with 3082 additions and 318 deletions

View File

@@ -241,7 +241,12 @@ void lv_dropdown_add_option(lv_obj_t * obj, 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);
@@ -269,9 +274,13 @@ void lv_dropdown_add_option(lv_obj_t * obj, 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;
#if LV_USE_ARABIC_PERSIAN_CHARS == 0
strcpy(ins_buf, option);
if(pos < ext->option_cnt)
strcat(ins_buf, "\n");
#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);
@@ -294,10 +303,8 @@ void lv_dropdown_set_selected(lv_obj_t * obj, uint16_t sel_opt)
ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
ext->sel_opt_id_orig = ext->sel_opt_id;
/*Move the list to show the current option*/
if(ext->list != NULL) {
lv_obj_invalidate(ddlist);
}
lv_obj_invalidate(ddlist);
}
/**