Git Product home page Git Product logo

Comments (3)

liamHowatt avatar liamHowatt commented on June 16, 2024

Hi @zylalx1,

Good find and thanks for the rigorous analysis! This probably hasn't been discovered because pre-setting text and using password mode together is less common.

Some or all of the below changes could help hide the characters immediately and refresh the bullet. We'll get others' opinions.

  • lv_textarea_set_text (your //4): It called auto_hide_characters but that only starts the countdown towards hiding them. If the the show time had already been set to zero, this works unmodified. Hiding the new text immediately is probably desirable for all show times.
  • lv_textarea_set_password_bullet (your //3): It called lv_obj_invalidate but as you discovered, it doesn't work. That's because the the temporary bullet buffer needed to be reloaded.
  • lv_textarea_set_password_show_time (your //2): An in-progress hide continued unaffected.

A drawback of using pwd_char_hider everywhere is that the in-progress show time countdown gets cancelled. If you wanted to have the bullet symbol flip between "X" and "#" rapidly the show time would be totally overridden.

diff --git a/src/widgets/textarea/lv_textarea.c b/src/widgets/textarea/lv_textarea.c
index 241f6753e..60780113d 100644
--- a/src/widgets/textarea/lv_textarea.c
+++ b/src/widgets/textarea/lv_textarea.c
@@ -316,8 +316,7 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt)
         LV_ASSERT_MALLOC(ta->pwd_tmp);
         if(ta->pwd_tmp == NULL) return;
 
-        /*Auto hide characters*/
-        auto_hide_characters(obj);
+        pwd_char_hider(obj);
     }
 
     lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
@@ -469,7 +468,7 @@ void lv_textarea_set_password_bullet(lv_obj_t * obj, const char * bullet)
         ta->pwd_bullet[txt_len] = '\0';
     }
 
-    lv_obj_invalidate(obj);
+    pwd_char_hider(obj);
 }
 
 void lv_textarea_set_one_line(lv_obj_t * obj, bool en)
@@ -544,6 +543,7 @@ void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time)
 
     lv_textarea_t * ta = (lv_textarea_t *)obj;
     ta->pwd_show_time = time;
+    pwd_char_hider(obj);
 }
 
 void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align)

I have some other tweaks but I'll save them for the potential PR.

from lvgl.

lvgl-bot avatar lvgl-bot commented on June 16, 2024

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

from lvgl.

kisvegabor avatar kisvegabor commented on June 16, 2024

Let's continue in the PR.

from lvgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.