bugfixes
Prevent infinite loop when reaching end of string on get_next_run Prevent warning about conversion to non const bidi_txt
This commit is contained in:
@@ -232,7 +232,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
|||||||
|
|
||||||
/*Get and process the runs*/
|
/*Get and process the runs*/
|
||||||
|
|
||||||
while(rd < len) {
|
while(rd < len && str_in[rd]) {
|
||||||
run_dir = get_next_run(&str_in[rd], base_dir, len - rd, &run_len, &pos_conv_run_len);
|
run_dir = get_next_run(&str_in[rd], base_dir, len - rd, &run_len, &pos_conv_run_len);
|
||||||
|
|
||||||
if(base_dir == LV_BIDI_DIR_LTR) {
|
if(base_dir == LV_BIDI_DIR_LTR) {
|
||||||
|
|||||||
@@ -626,7 +626,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *bidi_txt;
|
const char *bidi_txt;
|
||||||
uint16_t visual_byte_pos;
|
uint16_t visual_byte_pos;
|
||||||
#if LV_USE_BIDI
|
#if LV_USE_BIDI
|
||||||
/*Handle Bidi*/
|
/*Handle Bidi*/
|
||||||
@@ -638,7 +638,9 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_
|
|||||||
uint16_t line_char_id = lv_txt_encoded_get_char_id(&txt[line_start], byte_id - line_start);
|
uint16_t line_char_id = lv_txt_encoded_get_char_id(&txt[line_start], byte_id - line_start);
|
||||||
|
|
||||||
bool is_rtl;
|
bool is_rtl;
|
||||||
uint16_t visual_char_pos = lv_bidi_get_visual_pos(&txt[line_start], &bidi_txt, new_line_start - line_start, lv_obj_get_base_dir(label), line_char_id, &is_rtl);
|
char *mutable_bidi_txt;
|
||||||
|
uint16_t visual_char_pos = lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start, lv_obj_get_base_dir(label), line_char_id, &is_rtl);
|
||||||
|
bidi_txt = mutable_bidi_txt;
|
||||||
if (is_rtl) visual_char_pos++;
|
if (is_rtl) visual_char_pos++;
|
||||||
visual_byte_pos = lv_txt_encoded_get_byte_id(bidi_txt, visual_char_pos);
|
visual_byte_pos = lv_txt_encoded_get_byte_id(bidi_txt, visual_char_pos);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user