From af959cb94e3b2c7bbe9505586fe32a77064d0bf3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 5 Sep 2023 21:05:10 +0200 Subject: [PATCH] fix(draw): always set the bg_coords in lv_draw_glyph_dsc_t for placeholder drawing --- src/draw/lv_draw_label.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index 7ddb71cc6..b87036573 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -273,6 +273,12 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la letter_w = lv_font_get_glyph_width(font, letter, letter_next); + /*Always set the bg_coordinates for placeholder drawing*/ + bg_coords.x1 = pos.x; + bg_coords.y1 = pos.y; + bg_coords.x2 = pos.x + letter_w + dsc->letter_space - 1; + bg_coords.y2 = pos.y + line_height - 1; + if(i >= line_end - line_start) { if(dsc->decor & LV_TEXT_DECOR_UNDERLINE) { lv_area_t fill_area; @@ -296,14 +302,10 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la } } + + if(sel_start != 0xFFFF && sel_end != 0xFFFF && logical_char_pos >= sel_start && logical_char_pos < sel_end) { draw_letter_dsc.color = dsc->sel_color; - - bg_coords.x1 = pos.x; - bg_coords.y1 = pos.y; - bg_coords.x2 = pos.x + letter_w + dsc->letter_space - 1; - bg_coords.y2 = pos.y + line_height - 1; - fill_dsc.color = dsc->sel_bg_color; cb(draw_unit, NULL, &fill_dsc, &bg_coords); } @@ -311,6 +313,7 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la draw_letter_dsc.color = dsc->color; } + draw_letter(draw_unit, &draw_letter_dsc, &pos, font, letter, cb); if(letter_w > 0) {