Skip to content

Commit

Permalink
lv_ta: copy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Sep 20, 2019
1 parent cf1fed8 commit 9f978cb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/lv_objx/lv_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
ext->cursor.pos = copy_ext->cursor.pos;
ext->cursor.valid_x = copy_ext->cursor.valid_x;
ext->cursor.type = copy_ext->cursor.type;

if(ext->pwd_mode != 0) pwd_char_hider( new_ta);

if(copy_ext->placeholder != NULL)
ext->placeholder = lv_label_create(new_ta, copy_ext->placeholder);
else
ext->placeholder = NULL;

if(copy_ext->pwd_tmp) {
uint16_t len = lv_mem_get_size(copy_ext->pwd_tmp);
ext->pwd_tmp = lv_mem_alloc(len);
lv_mem_assert(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return NULL;

memcpy(ext->pwd_tmp, copy_ext->pwd_tmp, len);
}

if(copy_ext->one_line) lv_ta_set_one_line(new_ta, true);

lv_ta_set_style(new_ta, LV_TA_STYLE_CURSOR, lv_ta_get_style(copy, LV_TA_STYLE_CURSOR));
Expand Down Expand Up @@ -652,7 +669,8 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool en)
strcpy(ext->pwd_tmp, txt);

uint16_t i;
for(i = 0; i < len; i++) {
uint16_t encoded_len = lv_txt_get_encoded_length(txt);
for(i = 0; i < encoded_len; i++) {
txt[i] = '*'; /*All char to '*'*/
}
txt[i] = '\0';
Expand Down

0 comments on commit 9f978cb

Please sign in to comment.