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

Bug 568383

Summary: [Big Sur] Tree text is shortened with Ellipsis
Product: [Eclipse Project] Platform Reporter: Phil Beauvoir <p.beauvoir>
Component: SWTAssignee: Sravan Kumar Lakkimsetti <sravankumarl>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahmed, alexandr.miloslavskiy, gayanper, justin, lshanmug, peter, sravankumarl, ts-swt, twolf, yan
Version: 4.17   
Target Milestone: 4.20 M3   
Hardware: Macintosh   
OS: Mac OS X   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=572187
https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/180344
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=661387b5e458947746c4a4efab049276a38ff6db
Whiteboard:
Bug Depends on:    
Bug Blocks: 569361    
Attachments:
Description Flags
Screen shot
none
Screenshot none

Description Phil Beauvoir CLA 2020-10-29 18:20:05 EDT
Created attachment 284611 [details]
Screen shot

MacOS Big Sur 11.0.1 beta (20B5012d)

When launching a debug session from Eclipse any Tree cell with the longest text is shortened with an ellipsis (...)

1. Launch a debug session of Eclipse from Eclipse to spawn a new instance of Eclipse
2. Open Preferences and observe the tree texts.
Comment 2 Phil Beauvoir CLA 2020-11-05 06:53:30 EST
It's strange that some SWT Big Sur issues only manifest when running as a new Eclipse instance, RCP app, or snippet from Eclipse (Debug/Run). But they don't manifest when running Eclipse itself, or running the RCP app or snippet stand-alone (not from Eclipse).
Comment 3 Alexandr Miloslavskiy CLA 2020-12-03 06:29:33 EST
The difference is likely caused by the difference in SDK version of java executable, see:
  otool -l `which java` | grep sdk
Comment 4 Lakshmi P Shanmugam CLA 2021-02-09 17:24:40 EST
*** Bug 571020 has been marked as a duplicate of this bug. ***
Comment 5 Thomas Wolf CLA 2021-02-22 12:44:10 EST
Not sure this is Big Sur related. I just had this in a Eclipse Neon.3 child started from an Eclipse 2020-12 on OS X 10.14.6. Once. Didn't re-occur since then, though. The child was using JDK 1.8.0_191 from Oracle, host Eclipse using Amazon Corretto 11.0.3.
Comment 6 Lakshmi P Shanmugam CLA 2021-02-23 06:40:52 EST
(In reply to Thomas Wolf from comment #5)
> Not sure this is Big Sur related. I just had this in a Eclipse Neon.3 child
> started from an Eclipse 2020-12 on OS X 10.14.6. Once. Didn't re-occur since
> then, though. The child was using JDK 1.8.0_191 from Oracle, host Eclipse
> using Amazon Corretto 11.0.3.

It seems to be related to MacOS SDK version used to build the executable. Doesn't happen with Eclipse, built with 10.10 SDK.

Can you pls check the SDK version of the java that was used?
otool -l ./java | grep sdk
Comment 7 Thomas Wolf CLA 2021-02-23 07:24:17 EST
(In reply to Lakshmi P Shanmugam from comment #6)
> Can you pls check the SDK version of the java that was used?
> otool -l ./java | grep sdk

Which one? The JDK 1.8 reports "sdk 10.8", the Amazon Corretto 11.0.3 says "sdk 10.12".
Comment 8 Lakshmi P Shanmugam CLA 2021-05-06 07:14:38 EDT
With Bug 572187, the launcher SDK level is 10.14. This problem is now also seen in base Eclipse.
Comment 9 Lakshmi P Shanmugam CLA 2021-05-06 12:44:37 EDT
*** Bug 573297 has been marked as a duplicate of this bug. ***
Comment 10 Sravan Kumar Lakkimsetti CLA 2021-05-07 04:07:33 EDT
We are setting the lineBreakMode for the cell as NSLineBreakByTruncatingTail causing last three characters on the longest string to be replaced with ellipsis. 

Because at SWT we deal with integer arithmetic for sizes and OS uses floating point arithmetic, we get rounding errors when we calculate sizes. This causes size discrepancy in cell size and text contained in it. This causes OS to truncate the tail.

To fix this we should use NSLineBreakByClipping.
Comment 11 Eclipse Genie CLA 2021-05-07 04:09:57 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/180344
Comment 13 Sravan Kumar Lakkimsetti CLA 2021-05-07 04:18:33 EDT
Merged to master
Comment 14 Thomas Singer CLA 2021-05-07 04:24:48 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #10)
> We are setting the lineBreakMode for the cell as NSLineBreakByTruncatingTail
> causing last three characters on the longest string to be replaced with
> ellipsis. 
> 
> Because at SWT we deal with integer arithmetic for sizes and OS uses
> floating point arithmetic, we get rounding errors when we calculate sizes.
> This causes size discrepancy in cell size and text contained in it. This
> causes OS to truncate the tail.
> 
> To fix this we should use NSLineBreakByClipping.

Alternatively, you may round up the required cell width.
Comment 15 Lakshmi P Shanmugam CLA 2022-05-16 06:03:26 EDT
Backported the fix to 4.8, 4.11 and 4.15 maintenance branches.