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

Toggling breakpoints break when line spacing is high #93036

Closed
YeldhamDev opened this issue Jun 11, 2024 · 6 comments · Fixed by #92865
Closed

Toggling breakpoints break when line spacing is high #93036

YeldhamDev opened this issue Jun 11, 2024 · 6 comments · Fixed by #92865
Milestone

Comments

@YeldhamDev
Copy link
Member

Tested versions

  • Reproducible in: 4.3.dev [a7aa835] and 4.3.beta1.

System information

N/A

Issue description

When hovering/clicking the breakpoint gutter in a Text/CodeEdit node that has line_spacing set to a high value, it can result in the wrong line getting the breakpoint.

CC @kitbdev.

Steps to reproduce

  • Create a Text/CodeEdit node and put some text in it.
  • Set its line_spacing theme property to a high value (e. g. 10).
  • Run the project and move your mouse slowly in the gutter.

Minimal reproduction project (MRP)

Unnecessary, trivial to reproduce.

@radiantgurl
Copy link
Contributor

Looks like it might be TextEdit::get_line_column_at_pos screwing things over. I'll try to look over a fix.

@radiantgurl
Copy link
Contributor

radiantgurl commented Aug 1, 2024

int TextEdit::get_line_height() const {
	return MAX(text.get_line_height() + theme_cache.line_spacing, 1);
}

Shouldn't this account for it?
Unless the theme cache for line spacing isn't being updated properly.

@kitbdev
Copy link
Contributor

kitbdev commented Aug 1, 2024

I believe the issue is because TextEdit only redraws the gutter when the hovered gutter changes, but CodeEdit uses different logic to determine which one is hovered, causing the wrong one to be hovered and then not updating when it should.

CodeEdit::_main_gutter_draw_callback uses bool hovering = p_region.has_point(get_local_mouse_pos());, while TextEdit uses get_line_column_at_pos() which isn't the same as the rect sent for the draw callback. The gutter_clicked signal also uses get_line_column_at_pos().

#92865 fixes it by exposing get_hovered_gutter() and using that in CodeEdit instead.

@radiantgurl
Copy link
Contributor

#92865 fixes it by exposing get_hovered_gutter() and using that in CodeEdit instead.

Is the bug no longer reproducible in #92865 ?

@kitbdev
Copy link
Contributor

kitbdev commented Aug 2, 2024

Is the bug no longer reproducible in #92865 ?

Yes, I cannot reproduce it in #92865.

@KoBeWi KoBeWi removed this from the 4.3 milestone Aug 2, 2024
@kitbdev
Copy link
Contributor

kitbdev commented Sep 30, 2024

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

Successfully merging a pull request may close this issue.

5 participants