LVGL version
v9.5.0-95-gebc9c1be0
Platform
Platform independent
What happened?
Try scrolling a textarea with a long text. When releasing touch, it jumps back to the cursor position. So scrolling is not possible and the only way to navigate is with separate clicks to change the cursor position.
Example recording:
scroll-jump.mp4
How to reproduce?
This appears to be a regression after fix(textarea): scroll to position when style changes .
Ending scroll (maybe because it removes LV_STATE_SCROLLED) is also a possible style change, so lv_textarea_scroll_to_cusor_pos() is now called.
Fixed via
--- a/src/widgets/textarea/lv_textarea.c
+++ b/src/widgets/textarea/lv_textarea.c
@@ -928,7 +928,7 @@ static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e)
else if(code == LV_EVENT_DRAW_POST) {
draw_cursor(e);
}
- else if(code == LV_EVENT_SIZE_CHANGED || code == LV_EVENT_STYLE_CHANGED) {
+ else if(code == LV_EVENT_SIZE_CHANGED) {
lv_textarea_t * ta = (lv_textarea_t *)obj;
lv_textarea_scroll_to_cusor_pos(obj, ta->cursor.pos);
}
but maybe this reintroduces the bug that #9407 tried to fix? cc @AndreCostaaa
Playground with some textareas and buttons to insert/delete text:
lv_obj_t * textarea_l ;
lv_obj_t * textarea_c ;
lv_obj_t * textarea_r ;
static void simple_style (lv_obj_t * obj )
{
lv_obj_set_style_pad_column (obj , 0 , LV_PART_MAIN );
lv_obj_set_style_pad_all (obj , 5 , LV_PART_MAIN );
lv_obj_set_style_border_side (obj , LV_BORDER_SIDE_NONE , LV_PART_MAIN );
lv_obj_set_style_radius (obj , 0 , LV_PART_MAIN );
}
static void on_append (lv_event_t * )
{
lv_textarea_add_text (textarea_l , "Lorem ipsum dolor sit amet" );
lv_textarea_add_text (textarea_c , "Lorem ipsum dolor sit amet" );
lv_textarea_add_text (textarea_r , "Lorem ipsum dolor sit amet" );
}
static void on_backspace (lv_event_t * )
{
lv_textarea_delete_char (textarea_l );
lv_textarea_delete_char (textarea_c );
lv_textarea_delete_char (textarea_r );
}
void demo ()
{
lv_obj_t * screen = lv_obj_create (NULL );
lv_obj_set_size (screen , 1024 , 600 );
simple_style (screen );
lv_obj_set_flex_flow (screen , LV_FLEX_FLOW_COLUMN );
lv_obj_set_flex_align (screen , LV_FLEX_ALIGN_CENTER , LV_FLEX_ALIGN_CENTER , LV_FLEX_ALIGN_CENTER );
textarea_l = lv_textarea_create (screen );
lv_textarea_set_one_line (textarea_l , true);
lv_textarea_set_align (textarea_l , LV_TEXT_ALIGN_LEFT );
lv_textarea_set_text (textarea_l , "000000" );
lv_obj_set_size (textarea_l , 200 , 40 );
textarea_c = lv_textarea_create (screen );
lv_textarea_set_one_line (textarea_c , true);
lv_textarea_set_align (textarea_c , LV_TEXT_ALIGN_CENTER );
lv_textarea_set_text (textarea_c , "000000" );
lv_obj_set_size (textarea_c , 200 , 40 );
textarea_r = lv_textarea_create (screen );
lv_textarea_set_one_line (textarea_r , true);
lv_textarea_set_align (textarea_r , LV_TEXT_ALIGN_RIGHT );
lv_textarea_set_text (textarea_r , "000000" );
lv_obj_set_size (textarea_r , 200 , 40 );
lv_obj_t * append = lv_button_create (screen );
lv_obj_add_event_cb (append , on_append , LV_EVENT_CLICKED , nullptr );
lv_obj_t * backspace = lv_button_create (screen );
lv_obj_add_event_cb (backspace , on_backspace , LV_EVENT_CLICKED , nullptr );
lv_screen_load (screen );
}
LVGL version
v9.5.0-95-gebc9c1be0
Platform
Platform independent
What happened?
Try scrolling a textarea with a long text. When releasing touch, it jumps back to the cursor position. So scrolling is not possible and the only way to navigate is with separate clicks to change the cursor position.
Example recording:
scroll-jump.mp4
How to reproduce?
This appears to be a regression after fix(textarea): scroll to position when style changes.
Ending scroll (maybe because it removes
LV_STATE_SCROLLED) is also a possible style change, solv_textarea_scroll_to_cusor_pos()is now called.Fixed via
but maybe this reintroduces the bug that #9407 tried to fix? cc @AndreCostaaa
Playground with some textareas and buttons to insert/delete text: