Skip to content
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

Fix LineEdit caret rendering/positioning on Undo. #87012

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

TheSofox
Copy link
Contributor

@TheSofox TheSofox commented Jan 9, 2024

Fixes #67169.

This fixes the circumstance where undoing deleted text in LineEdit could lead to caret appearing outside of the box. (This bug has become even easier to reproduce with recent PR #86732 , though repo steps are the same )

The reason for this appears to be that in the undo() function, the set_caret_column() was called before the _shape() function. However, it seems the _shape() function needs to be called first (as it is in other parts of the LineEdit.cpp) as otherwise the get_caret_pixel_pos() that set_caret_column() uses gives an incorrect value (that the caret is at 0, 0).

I've reordered these functions in both undo() and redo() and the bug now appears fixed with the caret behaving appropriately when undoing.

@TheSofox TheSofox requested a review from a team as a code owner January 9, 2024 17:23
@AThousandShips AThousandShips added this to the 4.3 milestone Jan 9, 2024
@akien-mga akien-mga merged commit 3482da4 into godotengine:master Jan 15, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using redo/undo in LineEdit may break caret rendering
4 participants