OutputView: Filter ANSI sequences
ClosedPublic

Authored by kfunk on Dec 15 2015, 11:52 PM.

Details

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.

BUG: 321939
FIXED-IN: 5.0

Diff Detail

Repository
R33 KDevPlatform
Branch
5.0
Lint
No Linters Available
Unit
No Unit Test Coverage
kfunk updated this revision to Diff 1531.Dec 15 2015, 11:52 PM
kfunk retitled this revision from to OutputView: Filter ANSI sequences.
kfunk updated this object.
kfunk edited the test plan for this revision. (Show Details)
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptDec 15 2015, 11:52 PM
kfunk updated this revision to Diff 1532.Dec 16 2015, 12:13 AM

Made compile

apol added a subscriber: apol.Dec 17 2015, 11:37 AM

Other than that, looks good to me.

util/kdevstringhandler.cpp
219

else? switch?

kfunk marked an inline comment as done.Dec 17 2015, 11:59 AM

Fixed. Pushing.

This revision was automatically updated to reflect the committed changes.
mwolff added a subscriber: mwolff.Dec 17 2015, 1:19 PM
mwolff added inline comments.
outputview/outputmodel.cpp
70 ↗(On Diff #1531)

isn't it a bit overkill to have a qvector if we just have one function, and that one is even known at compile time?

I'd prefer if we simplify the code and make it only as complicated as needed:

std::transform(m_cachedLines.begin(), m_cachedLines.end(), KDevelop::stripAnsiSequences);
mwolff added inline comments.Dec 17 2015, 1:21 PM
outputview/outputmodel.cpp
121 ↗(On Diff #1531)

also, if we decide to keep it as complex as it is currently, I'd suggest you flip the order of the loops. the number cached lines is most of the time going to be much larger than the number of filter functions. thus looping over them first reduces cache misses.

kfunk added inline comments.Dec 17 2015, 2:00 PM
outputview/outputmodel.cpp
70 ↗(On Diff #1531)

Removed the vector, and turned std::for_each into std::transform.

Cheers,
Kevin

commit ee3d0a311c10b6c46b04cd950d6b0f4272fd6e49
Author: Kevin Funk <kfunk@kde.org>
Date:   Thu Dec 17 14:57:17 2015 +0100

    OutputModel: Reduce complexity re. pre-filtering
    
    Less extendable now, but it's also questionable if we ever need to extend
    it.
    
    Addresses Milian's concerns.