Bug 113128 - use color codes in output messages
Summary: use color codes in output messages
Status: RESOLVED LATER
Alias: None
Product: kdevelop
Classification: Applications
Component: Output Views (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2005-09-23 09:47 UTC by Ignacio Castaño
Modified: 2015-12-17 12:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ignacio Castaño 2005-09-23 09:47:36 UTC
Version:           3.2.90 (using KDE KDE 3.4.90)
Installed from:    Compiled From Sources

It would be nice if kdevelop message output console was able to handle ANSI color codes. That way, build systems (like scons) or compiler wrappers (like colorgcc) that output colors would produce a colored output in kdevelop without the need of parsing the output.

For example, executing the following line in a make file should produce a green text:

echo -e "\e[32mtext\e[0m"
Comment 1 Andreas Pakulat 2008-06-30 09:29:43 UTC
if somebody drops by that wants to implement this, please re-open.
Comment 2 kajokeji.2013 2013-12-01 12:36:01 UTC
KDevelop
Version 4.5.1
Using KDE Development Platform 4.11.3

The pcl library (http://pointclouds.org/) uses color console outputs that looks pretty bad in Kdevelop if not readable at all. For exemple in print.cpp (https://github.com/PointCloudLibrary/pcl/blob/master/common/src/print.cpp):
void pcl::console::reset_text_color (FILE *stream) {
  char command[13];
  // Command is the control command to the terminal
  sprintf (command, "%c[0;m", 0x1B);
  fprintf (stream, "%s", command);
}

If I check "Use external terminal", it goes well but I can't use the debug mode :-(.

I am wondering why the build tab is able to use colors and not the run/debug tab ?
Comment 3 Milian Wolff 2013-12-01 15:30:30 UTC
The build output view does not interpret color codes, but basically greps for keywords and then just colors the full line if it thinks its an error/warning/...
Comment 4 kajokeji.2013 2014-10-17 14:47:53 UTC
Would it be possible then to remove all the color codes (like "0x1N[0;m") before printing to the run tab in order to be able to read the messages without any color ? Indeed as the color codes are mis-interpreted, messages are not readable at all.
I believe boost uses the same kind of code colors, so this issue should concern many peoples.
Comment 5 Kevin Funk 2015-12-17 12:01:56 UTC
Git commit 9991a24e3d543f015380ce4f8c3d2dfca377aba4 by Kevin Funk.
Committed on 17/12/2015 at 11:58.
Pushed by kfunk into branch '5.0'.

OutputView: Filter ANSI sequences

Summary:
Hardcoding the filter function in the outputmodel for now.

Not making this a filter strategy on purpose, it doesn't fit into the
current architecture. Stripping ANSI sequences is merely a
QString->QString transformation, while the filtering strategies do a
QString->FilteredItem transformation.
Related: bug 321939
FIXED-IN: 5.0

Subscribers: apol, kdevelop-devel

Projects: #kdevelop

Differential Revision: https://phabricator.kde.org/D660

M  +15   -1    outputview/outputmodel.cpp
M  +63   -0    util/kdevstringhandler.cpp
M  +6    -0    util/kdevstringhandler.h
M  +19   -0    util/tests/test_stringhandler.cpp
M  +2    -0    util/tests/test_stringhandler.h

http://commits.kde.org/kdevplatform/9991a24e3d543f015380ce4f8c3d2dfca377aba4