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

Bug 197958

Summary: [console] TextConsoleViewer hyperlink style problem with other styles on line
Product: [Eclipse Project] Platform Reporter: Thomas Brandon <tbrandonau>
Component: DebugAssignee: Paul Pazderski <paul-eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: emoffatt, paul-eclipse, pawel.1.piech
Version: 3.3   
Target Milestone: 4.14 M1   
Hardware: PC   
OS: Windows XP   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=550620
Whiteboard:
Bug Depends on:    
Bug Blocks: 552030    
Attachments:
Description Flags
Test plugin
none
Sample output on current master
none
Sample output after change none

Description Thomas Brandon CLA 2007-07-26 09:00:13 EDT
Build ID: I20070625-1500

Steps To Reproduce:
Add a hyperlink in TextConsoleViewer on a line with an existing style provided by the document partitioner.

More information:
The attached plugin demonstrates the issue. Open the TextConsoleViewer Error->Sample View. A TextConsoleViewer is displayed with 4 lines each containing a hyperlink.
On the first line, with no styles display is correct.
On the second line where there is a style for the label, but no style for the hyperlink the hyperlink style is not applied. The hyperlink is there and works but is not styled.
On the third line a style is added to the label and a dummy style applied to the hyperlink. Here the hyperlink is correctly styled.
On the fourth line a style is provided for label and hyperlink but the same style is used for the hyperlink across multiple calls to the partitioners getStyleRanges method. Here the hyperlink initially displays correctly but when the TextConsoleViewer is redrawn (as occurs when you mouse over the hyperlink) the styling dissapears.
The issue is in the override method of TextConsoleViewer, called from lineGetStyle. If there are no styles specified for the line then this method correctly adds a new style for the hyperlink. If there are styles for the line the method removes the hyperlink from these styles' ranges and adds a new style. However in the case where there are ranges but none of them overlap the hyperlink no style is added for the hyperlink.
As this method modifies the ranges provided by the partitioner if ranges are shared across multiple calls to getStyledRanges then the first redraw removes the hyperlink from these ranges and on subsequent redraws there is no style for the hyperlinks range so it is not styled.
Comment 1 Thomas Brandon CLA 2007-07-26 09:01:32 EDT
Created attachment 74684 [details]
Test plugin
Comment 2 Paul Pazderski CLA 2019-08-30 18:04:31 EDT
I accidental fixed this problem with bug 550620. Also related with 111256 which had a similar problem but used a workaround and not fixed the root issue.
Comment 3 Paul Pazderski CLA 2019-08-30 18:09:14 EDT
Created attachment 279730 [details]
Sample output on current master
Comment 4 Paul Pazderski CLA 2019-08-30 18:09:33 EDT
Created attachment 279731 [details]
Sample output after change
Comment 5 Paul Pazderski CLA 2019-10-11 04:58:22 EDT
Build-ID: I20191009-1800