-
-
Notifications
You must be signed in to change notification settings - Fork 4k
fix(textarea): scroll to position when style changes #9407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 4 files
|
Hi 👋, thank you for your PR! We've run benchmarks in an emulated environment. Here are the results: ARM Emulated 32b - lv_conf_perf32b
Detailed Results Per Scene
ARM Emulated 64b - lv_conf_perf64b
Detailed Results Per Scene
Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode. 🤖 This comment was automatically generated by a bot. |
| lv_textarea_t * ta = (lv_textarea_t *)obj; | ||
|
|
||
| lv_point_t cur_pos; | ||
| lv_obj_update_layout(ta->label); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need it? LV_EVENT_SIZE_CHANGED should update the cursor position when deferred size calculation happened?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do as the label now only updates the size when we update its layout. It's a recent change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where the textarea widget doesn't properly scroll to the cursor position when style properties change. The fix ensures that when style-related changes occur (such as font size, padding modifications), the textarea updates its layout and repositions the scroll view to keep the cursor visible.
Key Changes:
- Added
LV_EVENT_STYLE_CHANGEDevent handling to trigger cursor position scrolling - Added
lv_obj_update_layout(ta->label)call to ensure label layout is updated before calculating cursor position - Minor code organization improvement by moving includes after the feature guard
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/widgets/textarea/lv_textarea.c | Added STYLE_CHANGED event handling and layout update to ensure cursor scrolls to correct position when styles change; reorganized includes after feature guard |
| tests/src/test_cases/widgets/test_textarea.c | Added test case to verify textarea doesn't unnecessarily scroll when text is fully visible |
| tests/ref_imgs/widgets/textarea_1.png | Reference screenshot for the new test case (software renderer) |
| tests/ref_imgs_vg_lite/widgets/textarea_1.png | Reference screenshot for the new test case (VG-Lite renderer) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #9210
Before:
After:
Notes
lv_conf_template.hrun lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py(astyle v3.4.12needs to installed by runningcd scripts; ./install_astyle.sh) and follow the Code Conventions.