godot icon indicating copy to clipboard operation
godot copied to clipboard

Expand Margin is not working in Styles for TextEdit

Open azagaya opened this issue 1 year ago • 6 comments

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

  1. Add a TextEdit
  2. Add a Style to it
  3. Use expand margins
  4. Note that it doesn't work as expected

Minimal reproduction project

TestTheme.zip

azagaya avatar Mar 05 '23 17:03 azagaya

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

azagaya avatar Mar 05 '23 18:03 azagaya

Why shouldn't it clip the contents?

AThousandShips avatar Mar 05 '23 18:03 AThousandShips

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)

azagaya avatar Mar 05 '23 18:03 azagaya

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.

azagaya avatar Mar 05 '23 18:03 azagaya

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: image

RPicster avatar Mar 05 '23 19:03 RPicster

Ok, text is clipping without that line, but not correctly. There must be a way to correctly clip text without this clipping the theme.

azagaya avatar Mar 06 '23 00:03 azagaya

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.)

t-karcher avatar Jun 23 '23 08:06 t-karcher

  • Clip contents can be disabled as of #89993

With clip contents disabled, the expand margin can be seen.

image

kitbdev avatar May 02 '24 22:05 kitbdev