lvgl icon indicating copy to clipboard operation
lvgl copied to clipboard

fix(theme_default): fix omitted style for selected text in `lv_textarea`

Open vwheeler63 opened this issue 1 year ago • 8 comments

Selected text, even though it existed, was not showing up in TextArea examples. The bug was merely a style to show the text as selected was omitted from the Default Theme -- remedied with this PR.

Credit goes to @kisvegabor for finding the cause.

Resolves #7321

Notes

  • Update the Documentation if needed. n/a
  • Add Examples if relevant. n/a
  • Add Tests if applicable. n/a
  • If you added new options to lv_conf_template.h run lv_conf_internal_gen.py and update Kconfig. n/a
  • Run scripts/code-format.py (astyle v3.4.12 needs to installed by running cd scripts; ./install_astyle.sh) and follow the Code Conventions. Done.
  • Mark the Pull request as Draft while you are working on the first version, and mark is as Ready when it's ready for review. Done.
  • When changes were requested, re-request review to notify the maintainers. Done.
  • Help us to review this Pull Request! Anyone can approve or request changes.

vwheeler63 avatar Nov 18 '24 12:11 vwheeler63

Sorry, I'm trying to verify the fix. Should it be possible in lv_example_textarea_1 to select text in the textarea with this fix? I can't seem to get the text to be selected with my pointer indev. It would be good to have this.

liamHowatt avatar Nov 25 '24 09:11 liamHowatt

Sorry, I'm trying to verify the fix. Should it be possible in lv_example_textarea_1 to select text in the textarea with this fix? I can't seem to get the text to be selected with my pointer indev. It would be good to have this.

Hi, @liamHowatt !

That example wasn't meant to have text selected, but if you want to set it up as a test environment, you merely need to add this line of code somewhere after the lv_textarea_t object is created:

    lv_textarea_set_text_selection(ta, true);

I wonder if it might be a good idea to install that line permanently. @kisvegabor Thoughts?

vwheeler63 avatar Nov 25 '24 11:11 vwheeler63

We should rather write a simple screen shot compare test for it here.

kisvegabor avatar Nov 25 '24 12:11 kisvegabor

We should rather write a simple screen shot compare test for it here.

Excellent idea! Is there a project going on to implement TDD in LVGL? I see a lot of tests being added, and I find it encouraging! (I've worked on projects where there is a thorough test bed, and they were wonderful to work with and added so much certainty at release time!)

vwheeler63 avatar Nov 25 '24 12:11 vwheeler63

It's not test driven but we at least test what we already have and what we newly add.

kisvegabor avatar Nov 25 '24 15:11 kisvegabor

Just a very minor comment, The two commits are necessary? style fixing at the part of the code changed it is implicitly part of the commit scope.

I suggest to squash into a single commit, and if needed mention in the commit body the style fix.

uLipe avatar Nov 25 '24 15:11 uLipe

I suggest to squash into a single commit, and if needed mention in the commit body the style fix.

It is my understanding that when this is merged it effectively does squash the 2 commits together. Then this branch is deleted and git will eventually clean up (i.e. delete) those 2 commits after a while since the reference to them (the branch) is gone. So at the moment, it is simply a record of that fact that I forgot to run code-format.py locally and only found out about the problem after I submitted the first commit.

vwheeler63 avatar Nov 25 '24 16:11 vwheeler63

It's not test driven but we at least test what we already have and what we newly add.

Hi, Gábor!

I had a situation today where I needed to update one of the tests — specifically test_scale.c and I could not find what calls these tests. The code I added I tested elsewhere (in one of the scale examples) so I know it works, but still it would be nice to be able to utilize these. Can you advise?

vwheeler63 avatar Nov 25 '24 21:11 vwheeler63

I suggest to squash into a single commit, and if needed mention in the commit body the style fix.

Unless it's explicitly requested by the author of PR we squash the PRs anyways.

I had a situation today where I needed to update one of the tests — specifically test_scale.c and I could not find what calls these tests. The code I added I tested elsewhere (in one of the scale examples) so I know it works, but still it would be nice to be able to utilize these. Can you advise?

You can run the tests locally like this:

cd tests
./main.py test

See more info here.

kisvegabor avatar Nov 26 '24 23:11 kisvegabor

You can run the tests locally like this:

Thank you!

vwheeler63 avatar Nov 27 '24 01:11 vwheeler63

Did it work?

kisvegabor avatar Nov 27 '24 05:11 kisvegabor

Did it work?

No. I walked it through a debugger and it is failing at attempting to call this on my system:

cmake --build E:\Dev\Clients\WGA\lvgl\vwheeler63\lvgl\tests\build_test_sysheap --parallel 4

When I try it on my command line from the ./tests/ directory as the script does, cmake.exe starts, but aborts with an error message: "Error: could not load cache". My ./tests/build_test_sysheap/ directory is empty.

Reading ./tests/README.md now....

Installed prerequisites.... Ran without error.

But cmake is still reporting "Error: could not load cache". And I don't know enough about CMake to pursue.

vwheeler63 avatar Nov 27 '24 14:11 vwheeler63

I recommend using WSL under Windows. :slightly_frowning_face:

kisvegabor avatar Nov 27 '24 23:11 kisvegabor

Great find and great solution.

Credit goes to @kisvegabor for the solution on this one. I just "helped". 😄

vwheeler63 avatar Nov 28 '24 16:11 vwheeler63

I recommend using WSL under Windows.

Got it. Thank you! One of these days I'm gonna have to break out my Ubuntu WSL....

vwheeler63 avatar Nov 28 '24 16:11 vwheeler63