portfolio icon indicating copy to clipboard operation
portfolio copied to clipboard

Description widget: issue with line breaks

Open ma4nn opened this issue 3 years ago • 0 comments

Describe the bug The new description widget has some edge cases where a multi-line text is not breaking correctly. The issue is caused by the underlying StyledLabel component. I have scratched my head around this, but I am not so much into the Java & SWT details so perhaps some Java people can help me with this.

To Reproduce Steps to reproduce the behavior:

  1. Create a new empty dashboard under Reports > Performance and remove all columns except one
  2. Add a description widget (Right Click > New Widget > General > Description) with a longer text that automatically breaks into multiple lines
  3. Right click and add a new column to the right
  4. Verify that the text in the description widget is now no longer breaking into multiple lines correctly and rather cut off on the right side
  5. Click on the current dashboard name in the upper right (dashboard is being recreated)
  6. Verify that the description text is now breaking correctly again

The same behaviour appears e.g. if you e.g. add any widget into the second column and remove that widget again.

Expected behavior The line breaks in the description widget should always be correct.

What I have found out so far

  • the issue is caused by the StyledLabel component not being able to determine the boundaries correctly, if I use the regular Label component or set a fixed width it works as expected
  • if I disable the computeSize() logic in updateScrolledCompositeMinSize() the problem disappears, the breaking works correctly
  • perhaps it is somehow related to DashboardLayout::computeSize() and this comment, but I wasn't able to add the width there:
    // at the moment, the width of the column does not matter because
    // none of the widgets actually wrap so we can safely ignore the
    // computed width
    
  • after the update of quotes and automatic refresh of the dashboard the line breaks are also correct again

Desktop (please complete the following information):

  • OS: macOS 12.4
  • Version 0.59.0

Any hint or help is appreciated 🤯

ma4nn avatar Aug 05 '22 09:08 ma4nn