Bug 544773

Summary: Support Multiline Code Mining
Product: [Eclipse Project] Platform Reporter: Max Leuthäuser <max.leuthaeuser>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: dorian.blaj, eclipse, gautier.desaintmartinlacaze, sebastian.zarnekow
Version: 4.11   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Rendered code mining with line breaks. none

Description Max Leuthäuser CLA 2019-02-25 08:55:07 EST
Created attachment 277676 [details]
Rendered code mining with line breaks.

Overview:

Currently, code mining only supports text without line breaks.
This is due to the fact that `org.eclipse.jface.text.codemining.AbstractCodeMining.draw`
only calls `org.eclipse.swt.graphics.GC.drawString` and `org.eclipse.swt.graphics.GC.stringExtent`. They do not execute any tab expansion or carriage return processing as documented.

To Reproduce:

Simply override `org.eclipse.jface.text.codemining.AbstractCodeMining.draw` and call `org.eclipse.swt.graphics.GC.drawText` and `org.eclipse.swt.graphics.GC.textExtent` instead (they do carriage return processing). Now, line breaks are rendered correctly. On the downside, the following text in the editor will overlap because `org.eclipse.jface.text.source.inlined.LineHeaderAnnotation.getHeight` only calculates the text height with `org.eclipse.swt.custom.StyledText.getLineHeight` not taking line breaks into account (see the attached image).

Expected Results:

`org.eclipse.jface.text.source.inlined.LineHeaderAnnotation.getHeight` takes newlines (if present) into account.

Note:

The same applies to `org.eclipse.jface.text.source.inlined.LineContentAnnotation`.
Comment 1 Sebastian Zarnekow CLA 2019-05-06 09:17:03 EDT
*** Bug 546995 has been marked as a duplicate of this bug. ***
Comment 2 Dorian Blaj CLA 2021-10-28 03:56:10 EDT
we would also be interested in this feature.
We actually tries to implement some in-house solution, which works rather well on default resolution scaling (100%), however it has issues when the resolution scaling  is non-default.