@@ -1107,7 +1107,9 @@ static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e)
1107
1107
c != LV_KEY_SELECT_RIGHT &&
1108
1108
c != LV_KEY_SELECT_LEFT &&
1109
1109
c != LV_KEY_SELECT_UP &&
1110
- c != LV_KEY_SELECT_DOWN
1110
+ c != LV_KEY_SELECT_DOWN &&
1111
+ c != LV_KEY_SELECT_TILL_EOL &&
1112
+ c != LV_KEY_SELECT_FROM_SOL
1111
1113
) {
1112
1114
lv_textarea_selection_stop (obj );
1113
1115
}
@@ -1146,6 +1148,12 @@ static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e)
1146
1148
lv_textarea_cursor_down (obj );
1147
1149
lv_textarea_selection_continue (obj );
1148
1150
}
1151
+ else if (c == LV_KEY_SELECT_FROM_SOL ) {
1152
+ update_selection_expand (obj , 0 );
1153
+ }
1154
+ else if (c == LV_KEY_SELECT_TILL_EOL ) {
1155
+ update_selection_expand (obj , 1 );
1156
+ }
1149
1157
else if (c == LV_KEY_RIGHT )
1150
1158
lv_textarea_cursor_right (obj );
1151
1159
else if (c == LV_KEY_LEFT )
@@ -1454,6 +1462,36 @@ void update_selection_word(lv_event_t* e) {
1454
1462
#endif
1455
1463
}
1456
1464
1465
+ void update_selection_expand (lv_obj_t * obj , int direction ) {
1466
+ LV_ASSERT_OBJ (obj , MY_CLASS );
1467
+ #if LV_LABEL_TEXT_SELECTION
1468
+ lv_textarea_t * ta = (lv_textarea_t * )obj ;
1469
+ uint32_t c ;
1470
+ uint32_t pos ;
1471
+ uint32_t oldpos ;
1472
+ pos = lv_textarea_get_cursor_pos (ta );
1473
+ oldpos = -1 ;
1474
+ lv_textarea_selection_start (ta );
1475
+ while (oldpos != pos ) {
1476
+ if (direction == 0 ) {
1477
+ lv_textarea_cursor_left (ta );
1478
+ } else {
1479
+ lv_textarea_cursor_right (ta );
1480
+ }
1481
+ oldpos = pos ;
1482
+ pos = lv_textarea_get_cursor_pos (ta );
1483
+ lv_textarea_selection_continue (ta );
1484
+ c = lv_textarea_get_current_char (ta );
1485
+ if (c == '\n' || c == '\r' ) {
1486
+ break ;
1487
+ }
1488
+ }
1489
+ lv_textarea_selection_stop (ta );
1490
+ #else
1491
+ #endif
1492
+ }
1493
+
1494
+
1457
1495
static void update_cursor_position_on_click (lv_event_t * e )
1458
1496
{
1459
1497
lv_indev_t * click_source = lv_indev_active ();
0 commit comments