Bug 544773 - Support Multiline Code Mining
Summary: Support Multiline Code Mining
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.11   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 546995 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-02-25 08:55 EST by Max Leuthäuser CLA
Modified: 2021-10-28 03:56 EDT (History)
4 users (show)

See Also:


Attachments
Rendered code mining with line breaks. (25.83 KB, image/png)
2019-02-25 08:55 EST, Max Leuthäuser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.