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

[TextEdit] Use style margins for selection in read-only mode. #92505

Merged
merged 1 commit into from
May 29, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented May 29, 2024

Fixes #92312

Adds margins in the same way draw code do:

if (!editable) {
ofs_x = theme_cache.style_readonly->get_offset().x / 2;
ofs_x -= theme_cache.style_normal->get_offset().x / 2;
ofs_y = theme_cache.style_readonly->get_offset().y / 2;
} else {
ofs_y = theme_cache.style_normal->get_offset().y / 2;
}

@bruvzg bruvzg added this to the 4.3 milestone May 29, 2024
@bruvzg bruvzg requested a review from a team as a code owner May 29, 2024 06:30
@akien-mga
Copy link
Member

akien-mga commented May 29, 2024

The unit test for TextEdit seems to be failing.

@bruvzg
Copy link
Member Author

bruvzg commented May 29, 2024

The unit test for TextEdit seems to be failing.

Should be fixed, but seems like draw code use strange values as well, this is not directly related to the specific issue, but it might have a lot more issues if different margins are set for different styles. I'll check it later.

@timothyqiu
Copy link
Member

I'm a bit curious why the offset (vector of the left margin and top margin) was divided by 2. 🤔

@bruvzg
Copy link
Member Author

bruvzg commented May 29, 2024

I'm a bit curious why the offset (vector of the left margin and top margin) was divided by 2. 🤔

No idea, but it is used like this when drawing.

@akien-mga akien-mga merged commit 219af36 into godotengine:master May 29, 2024
16 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.

Read only TextEdit does not use content margin for text selection
3 participants