feat(textarea): add lv_textarea_get_current_char(obj) (#3536)

* Update lv_textarea.h

add uint32_t lv_textarea_get_right_char(lv_obj_t * obj);  //Get a the right character from the current cursor position

* Update lv_textarea.c

Add uint32_t lv_textarea_get_right_char(lv_obj_t * obj); Get a the right character from the current cursor position

* Add uint32_t lv_textarea_get_right_char(lv_obj_t * obj); /* Get a the right character from the current cursor position */Y

* Rename name to 'lv_textarea_get_current_char(..)' and modify 'int' to 'uint32_t'

Co-authored-by: root <root@localhost.localdomain>
This commit is contained in:
tries
2022-08-05 06:24:58 +08:00
committed by GitHub
parent 35a3b5ee8d
commit 4a7ddf9f19
2 changed files with 20 additions and 0 deletions
+13
View File
@@ -704,6 +704,19 @@ uint16_t lv_textarea_get_password_show_time(lv_obj_t * obj)
return ta->pwd_show_time;
}
uint32_t lv_textarea_get_current_char(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
const char * txt = lv_textarea_get_text(obj);
lv_textarea_t * ta = (lv_textarea_t *)obj;
uint32_t pos = ta->cursor.pos;
if(_lv_txt_get_encoded_length(txt) >= pos && pos > 0)
return _lv_txt_encoded_prev(txt, &pos);
else
return 0;
}
/*=====================
* Other functions
*====================*/
+7
View File
@@ -308,6 +308,13 @@ bool lv_textarea_get_text_selection(lv_obj_t * obj);
*/
uint16_t lv_textarea_get_password_show_time(lv_obj_t * obj);
/**
* Get a the character from the current cursor position
* @param obj pointer to a text area object
* @return a the character or 0
*/
uint32_t lv_textarea_get_current_char(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/