Fix SpinBox will reset unsubmitted text when redrawing #81638
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should fix #79507
As I mentioned in the issue, this commit added
_update_text()
toNOTIFICATION_DRAW
. And insided_update_text()
, it uses the shared range value to update theline_edit
's text, but the value will override the unsubmited user's input.Originally this commit makes sense because user may call
set_value_no_signal
which will directly change shared range's value, but when a user input some text and then triggeredNOTIFICATION_DRAW
, this could be wrong and cause this bug.So we will encounter a situation where we have two sources of value that need to consider in
_update_text
, one from script likeset_value_no_signal
which directly change range's value , one from user's uncommited input reflected inline_edit
compoment.Basically what my fix do is that it trys to remember the last_updated_text, and when the value get from shared range equals this last_updated_text but not euqal to line_edit's current value, just return to keep line_edit's current value. That being saied, when a user is inputing something and some script called
set_value_no_signal
at the same time, this code will keep the shared range's value instead of user's input.It should work in most cases, I know this is not the best fix, but I think it is less invasive in this way. I would appreciate any feedback or alternative suggestions.