godot
godot copied to clipboard
Expand Margin is not working in Styles for TextEdit
Godot version
4.1.dev (5dccc94)
System information
Ubuntu 22.04, Vulkan renderer, gforce 1650ti
Issue description
Modifying the Expand Margin property in a style applied to a TextEdit does not draw extending outside the rect like in other controls, which causes the style to be clipped.
Steps to reproduce
- Add a TextEdit
- Add a Style to it
- Use expand margins
- Note that it doesn't work as expected
Minimal reproduction project
In line 514 of text_edit.cpp we have this line which causes the issue:
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);
Is it safe to remove it? I dont see why this was added
Why shouldn't it clip the contents?
Why shouldn't it clip the contents?
As its shown in the example project, Is definitely not working as expected, at least not as all the rest of the controls work. The expand margin is useless for TextEdit as it is now.
Btw, this is not "clip the text content", the text is clipped anyways with or without that line removed. This is just clipping the draw rect, which causes nothing to be drawn outside the control rects, which causes expand margin not be usable.
Changing that line make expand margin work as expected (i mean consistent with the rest of the control nodes)
To be honest, i think when fixing these it should be also added that you could move the scroll bars. They are annoying sometimes that overlap with the borders of the theme.
It would be the only control (to my knowledge) with this behaviour, so it would be not very predictable behaviour and would make certain elements in the theme/style unusable:
Ok, text is clipping without that line, but not correctly. There must be a way to correctly clip text without this clipping the theme.
It would be the only control (to my knowledge) with this behaviour
Nope. ScrollContainer has the same issue, see #78523 (I originally reported the missing drop shadow, but expand margin also doesn't work.)
- Clip contents can be disabled as of #89993
With clip contents disabled, the expand margin can be seen.