Open YeldhamDev opened 3 months ago
Looks like it might be TextEdit::get_line_column_at_pos
screwing things over. I'll try to look over a fix.
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.
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()
.
https://github.com/godotengine/godot/pull/92865 fixes it by exposing get_hovered_gutter()
and using that in CodeEdit
instead.
https://github.com/godotengine/godot/pull/92865 fixes it by exposing get_hovered_gutter() and using that in CodeEdit instead.
Is the bug no longer reproducible in #92865 ?
Is the bug no longer reproducible in https://github.com/godotengine/godot/pull/92865 ?
Yes, I cannot reproduce it in #92865.
Tested versions
System information
N/A
Issue description
When hovering/clicking the breakpoint gutter in a
Text/CodeEdit
node that hasline_spacing
set to a high value, it can result in the wrong line getting the breakpoint.CC @kitbdev.
Steps to reproduce
Text/CodeEdit
node and put some text in it.line_spacing
theme property to a high value (e. g. 10).Minimal reproduction project (MRP)
Unnecessary, trivial to reproduce.