Skip to content

Conversation

WhalesState
Copy link
Contributor

@WhalesState WhalesState commented Sep 15, 2025

@WhalesState WhalesState changed the title Fix TextEdit drawing both normal and read_only styles together Fix uneditable TextEdit draws both normal and read_only styles together Sep 15, 2025
@WhalesState

This comment was marked as resolved.

@WhalesState WhalesState marked this pull request as ready for review September 15, 2025 07:24
@WhalesState WhalesState requested a review from a team as a code owner September 15, 2025 07:24
@AThousandShips AThousandShips added bug topic:gui cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Sep 15, 2025
@AThousandShips AThousandShips added this to the 4.6 milestone Sep 15, 2025
Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.


int visible_width = get_size().width - theme_cache.style_normal->get_minimum_size().width - gutters_width - gutter_padding;
Ref<StyleBox> style = _get_current_stylebox();
int visible_width = get_size().width - Math::ceil(style->get_margin(SIDE_LEFT)) - Math::floor(style->get_margin(SIDE_RIGHT)) - gutters_width - gutter_padding;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the issue where the last character was cut off when the editor scale is a fractional number. Previously, we used style->get_minimum_size().width, but draw methods always round up the left and right style margins with Math::ceil, which caused a mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release topic:gui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script editor stops scrolling one column early TextEdit/LineEdit inconsistency when non-editable
3 participants