eclipse-platform / eclipse-platform/eclipse.platform

Invalid StyleRange in TextConsoleViewer

Open
#542 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

Hi,

I noticed that the the function org.eclipse.ui.console.TextConsoleViewer.findPosition(int, int, Position[]) returns sometime some positions that do not overlap with the specified range.

Here is an implementation that should works better : https://github.com/eclipse-platform/eclipse.platform.debug/blob/3fb256714bfe524465c6b579d4a9a8d03a84cca7/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/AnsiDocumentPartitioner.java#L83

To reproduce the problem, execute the following snippet:
` public static void testException()
{

try
{
Integer.parseInt("4za4e4a");
}
catch (Exception e) {
e.printStackTrace();
System.err.println("normal");
}

}
`
and inspect the resulting LineStyleEvent : https://github.com/eclipse-platform/eclipse.platform.debug/blob/3fb256714bfe524465c6b579d4a9a8d03a84cca7/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/AnsiDocumentPartitioner.java#L138

If interested I can provide a PR to fix this issue.

Yannick

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.