Community
Participate
Working Groups
3.5 and I20100504-0800 The link widget does not properly wrap on Cocoa. If you open the ControlExample, select Size > Preferred, Horizontal Fill, and then make the window narrow, the Link wraps on WinXP and GTK, but doesn't wrap on Cocoa. When Vertical Fill is also checked, it also works properly on Cocoa. This bug can also be seen in the SDK in "Preferences > Java > Editor" and "Preferences > Java > Editor > Syntax Coloring" (links on top don't wrap).
Link.computeSize has a TODO in it that basically says it isn't implemented. This is pretty safe to add for 3.6.
Created attachment 167260 [details] Fix Implemented computeSize using code from the multiline Text case. Also cleaned up creation of the widget so that the BORDER and non-BORDER case has a consistent gap around it, and matches Carbon.
Felipe, can you review?
Good to go, two (small) things I might have done differently: 1) Why setting the line fragment padding to zero when no border ? we don't do that for any other widget causes the different in the size of no border/border to be greater. 2) Link#computeSize() started with if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; This code is correct IMO and was removed by the patch.
(In reply to comment #4) > Good to go, > > two (small) things I might have done differently: > 1) Why setting the line fragment padding to zero when no border ? > we don't do that for any other widget > causes the different in the size of no border/border to be greater. This is done primarily for compatibility/fidelity with Carbon. A Link is implemented with an NSTextView, but shouldn't look any different than a Label. That was fixed in bug 276115. Turns out this was slightly wrong anyway. I should set the padding to 2 all the time and then adjust the height and width returned in computeSize if there isn't a border. This way the size of the widget is the same whether or not there's a border, and it has the same appearance as a Label. > 2) Link#computeSize() started with > if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; > if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; > > This code is correct IMO and was removed by the patch. I had taken this out because the WRAP case from Text didn't have it, but now that I understand what it's doing, yes, it should go back.
Fixed > 20100506.