This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268941 - Missing support for gcc -fdiagnostics-color=always in output window
Summary: Missing support for gcc -fdiagnostics-color=always in output window
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Output Window (show other bugs)
Version: Dev
Hardware: PC Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-11 13:05 UTC by atomsymbol
Modified: 2017-04-13 11:10 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
example.png (6.67 KB, image/png)
2016-11-11 13:05 UTC, atomsymbol
Details
proposed patch (6.36 KB, patch)
2017-04-04 11:52 UTC, Alexander Simon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description atomsymbol 2016-11-11 13:05:03 UTC
Created attachment 162874 [details]
example.png

Netbeans isn't recognizing error lines in the output window in the following cases:

gcc -fdiagnostics-color=always
g++ -fdiagnostics-color=always
clang -fcolor-diagnostics
clang++ -fcolor-diagnostics

If color diagnostics is turned off, clicking on "file.c:23: error: ..." in the output window focuses file.c and moves the caret to line 23.

----

An alternative solution is to use -fdiagnostics-color=auto instead of -fdiagnostics-color=always
Comment 1 Alexander Simon 2017-03-28 16:03:46 UTC
Output window ignores output listener in colored line.
Comment 2 Alexander Simon 2017-03-28 16:09:28 UTC
It looks like method OutWriter.print(CharSequence s, OutputListener l, boolean important, Color c, Color b, OutputKind outKind, boolean addLS) is wrong. It should pass listener to the method doWrite().
Comment 3 Alexander Simon 2017-04-04 11:52:23 UTC
Created attachment 164021 [details]
proposed patch
Comment 4 Jaroslav Havlin 2017-04-04 14:42:26 UTC
The patch looks very good to me.

I have only one minor comment regarding changes in AbstractLines.java:

Isn't this:

  info.addSegment(endPos - trailingCnt, outKind, l, c, b, important);
  if (trailingCnt > 0) {
     // have to underline all trailing spaces (we cannot know if there are more segments)
     info.addSegment(endPos, outKind, l, c, b, important);
  }

The same as:

  info.addSegment(endPos, outKind, l, c, b, important);

I.e. only one segment instead of two segments with the same listener and colors.

Is it necessary start underlining the trailing whitespace? Using the current
behavior (adding "empty" segment with no listener and colors) doesn't work with
your changes?
(I'm not saying it's wrong, I'm just curious.)

Thank you very much for fixing this!
Comment 5 Alexander Simon 2017-04-04 14:59:57 UTC
(In reply to Jaroslav Havlin from comment #4)
> The patch looks very good to me.
> 
> I have only one minor comment regarding changes in AbstractLines.java:
> 
> Isn't this:
> 
>   info.addSegment(endPos - trailingCnt, outKind, l, c, b, important);
>   if (trailingCnt > 0) {
>      // have to underline all trailing spaces (we cannot know if there are
> more segments)
>      info.addSegment(endPos, outKind, l, c, b, important);
>   }
> 
> The same as:
> 
>   info.addSegment(endPos, outKind, l, c, b, important);

Yes. it is the same.
The better solution is skip trailing spaces only in last segment. But there is no way to understand that it is last segment.

For example colored message:
welcome.cc:10:9: error: 'argc' was not declared in this scope
has segments:
- "welcome.cc:10:9:" 
- " "
- "error: "
- "'argc' was not declared in this scope"
with 3 colors.
If we do not underline trailing spaces, IDE interrupts underline after "error:".
If we do not underline leading spaces, IDE interrupts underline after "welcome.cc:10:9:". Fortunately we can skip leading spaces for first segment.

> 
> I.e. only one segment instead of two segments with the same listener and
> colors.
> 
> Is it necessary start underlining the trailing whitespace? Using the current
> behavior (adding "empty" segment with no listener and colors) doesn't work
> with
> your changes?
> (I'm not saying it's wrong, I'm just curious.)
> 
> Thank you very much for fixing this!
Comment 6 Jaroslav Havlin 2017-04-04 15:07:39 UTC
I understand now.
Thank you, great job.
Comment 7 Alexander Simon 2017-04-04 16:24:20 UTC
fixed in enum, branch release82, changeset d2a0b3f48daf
Comment 8 Quality Engineering 2017-04-11 01:52:11 UTC
Integrated into 'main-silver', will be available in build *201704110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1d81d1443e1e
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #268941 Missing support for gcc -fdiagnostics-color=always in output window
(transplanted from d2a0b3f48dafbf0772038c0cb7fa8a95bcbcf2a6)
Comment 9 ilia 2017-04-13 10:45:11 UTC
https://netbeans.org/bugzilla/show_bug.cgi?id=268941 Changesets:
    http://hg.netbeans.org/releases/rev/d2a0b3f48daf # fixed Bug #268941 Missing support for gcc -fdiagnostics-color=always in output window
Comment 10 atomsymbol 2017-04-13 11:10:45 UTC
I see the patch will be in Netbeans 8.2 Patch 2. Thanks!