Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 405664

Summary: [Label] Using a Label with WRAP truncates the text on resize if only width changed
Product: [RT] RAP Reporter: Sebastien Arod <sebastien.arod>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: tbuschto
Version: 2.0   
Target Milestone: 2.1 RC1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
A snippet project showing the problem none

Description Sebastien Arod CLA 2013-04-13 04:06:20 EDT
Created attachment 229692 [details]
A snippet project showing the problem

Reproducible case:
* Create a Label with SWT.WRAP that fill the whole shell
* Initialize the text to something that use more than 1 line 
* Size the shell so that it can fit more line than the text requires at initialization
* Shrink the shell in width being careful not to change the height so that at least one new line should be created to display text.
=> The required new lines are not displayed and the text ends-up being truncated

I attach a project to reproduce the bug. With the snippet just start the BugSnippetEntryPoint and reduce width until you see some truncated.
Comment 1 Sebastien Arod CLA 2013-04-13 04:11:06 EDT
Note that the problem is fixed as soon as you resize vertically.
Comment 2 Ivan Furnadjiev CLA 2013-04-15 05:23:59 EDT
I can reproduce it with your snippet.
Comment 3 Ivan Furnadjiev CLA 2013-04-15 06:31:50 EDT
Overriding the _applyWidth method in MultiCellWidget.js fixes the issue:
...
_applyWidth : function( value, old ) {
  this.base( arguments, value, old );
  if( this._flexibleCell !== -1 ) {
    this._scheduleLayoutY();
  }
},
...
We have a test that have to ensure exactly this behavior (MultiCellWidgetTest.js#testFlexibleCellWrap), but it is green with/without this override. Tim, what do you think?
Comment 4 Tim Buschtoens CLA 2013-05-13 08:49:06 EDT
Fixed with commit b4f346505002ac1892aeb21d07e33fa744feee8e.

The test was a false green because MultiCellWidget#getCellHeight always returns a freshly computed value, so the test did not check the actually rendered value.