fix(textarea): fix max length handling
This commit is contained in:
@@ -963,19 +963,13 @@ static bool char_is_accepted(lv_obj_t * obj, uint32_t c)
|
||||
{
|
||||
lv_textarea_t * ta = (lv_textarea_t *)obj;
|
||||
|
||||
/*If the accepted char list in not specified the accept the character*/
|
||||
if(ta->accepted_chars == NULL) return true;
|
||||
|
||||
/*If no restriction accept it*/
|
||||
if((ta->accepted_chars == NULL || ta->accepted_chars[0] == '\0') && ta->max_length == 0) return true;
|
||||
|
||||
/*Too many characters?*/
|
||||
if(ta->max_length > 0 && _lv_txt_get_encoded_length(lv_textarea_get_text(obj)) >= ta->max_length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ta->accepted_chars == NULL || ta->accepted_chars[0] == '\0') return true;
|
||||
/*Accepted character?*/
|
||||
/*We're sure ta->accepted_chars != NULL*/
|
||||
uint32_t i = 0;
|
||||
|
||||
while(ta->accepted_chars[i] != '\0') {
|
||||
|
||||
Reference in New Issue
Block a user