From 127d8e82e344cd8762672e787b1ee06390050b65 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 24 Mar 2022 18:48:25 +0100 Subject: [PATCH] fix(textarea): fix max length handling --- src/widgets/lv_textarea.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 6b5ec4e46..8624b01d0 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -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') {