From b634a63963ef748bc17bf68227f644322444e627 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 19 May 2021 15:29:17 +0200 Subject: [PATCH] fix(textarea, spinbox) fix cursor position and size --- src/extra/themes/default/lv_theme_default.c | 2 +- src/widgets/lv_textarea.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index c00cdce6c..8468d5b77 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -926,7 +926,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) lv_obj_add_style(obj, &styles->pad_small, 0); lv_obj_add_style(obj, &styles->outline_primary, LV_STATE_FOCUS_KEY); lv_obj_add_style(obj, &styles->outline_secondary, LV_STATE_EDITED); - lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_CURSOR | LV_STATE_FOCUSED); + lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_CURSOR); } #endif #if LV_USE_TILEVIEW diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 5147811dc..427be7817 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -1101,8 +1101,8 @@ static void refr_cursor_area(lv_obj_t * obj) lv_area_t cur_area; cur_area.x1 = letter_pos.x - left; cur_area.y1 = letter_pos.y - top; - cur_area.x2 = letter_pos.x + right + letter_w; - cur_area.y2 = letter_pos.y + bottom + letter_h; + cur_area.x2 = letter_pos.x + right + letter_w - 1; + cur_area.y2 = letter_pos.y + bottom + letter_h - 1; /*Save the new area*/ lv_area_t area_tmp; @@ -1311,7 +1311,7 @@ static void draw_cursor(lv_event_t * e) if(cur_dsc.bg_opa == LV_OPA_COVER) { lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_CURSOR); lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_CURSOR); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_CURSOR); cur_area.x1 += left + border_width; cur_area.y1 += top + border_width;