Skip to content

Commit

Permalink
fix(draw_label) Move back the recolor handling
Browse files Browse the repository at this point in the history
  • Loading branch information
C47D committed Oct 19, 2024
1 parent 0d1bd7e commit 2ac1fbf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/draw/lv_draw_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,17 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
while(i < line_end - line_start) {
uint32_t logical_char_pos = 0;

/* Check if the text selection is enabled */
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
#else
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start + i);
#endif
}

uint32_t letter;
uint32_t letter_next;
lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
Expand Down Expand Up @@ -361,17 +372,6 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
}
}

/* Check if the text selection is enabled */
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
#else
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start + i);
#endif
}

/* If we're in the CMD_STATE_IN state then we need to subtract the recolor command length */
if(((dsc->flag & LV_TEXT_FLAG_RECOLOR) != 0) && (cmd_state == CMD_STATE_IN)) {
logical_char_pos -= (LABEL_RECOLOR_PAR_LENGTH + 1);
Expand Down

0 comments on commit 2ac1fbf

Please sign in to comment.