diff --git a/src/decoders/PlainTextDecoder.cpp b/src/decoders/PlainTextDecoder.cpp index 01466e546..77ceb8e7d 100644 --- a/src/decoders/PlainTextDecoder.cpp +++ b/src/decoders/PlainTextDecoder.cpp @@ -18,23 +18,11 @@ using namespace Konsole; PlainTextDecoder::PlainTextDecoder() : _output(nullptr) - , _includeLeadingWhitespace(true) - , _includeTrailingWhitespace(true) , _recordLinePositions(false) , _linePositions(QList()) { } -void PlainTextDecoder::setLeadingWhitespace(bool enable) -{ - _includeLeadingWhitespace = enable; -} - -void PlainTextDecoder::setTrailingWhitespace(bool enable) -{ - _includeTrailingWhitespace = enable; -} - void PlainTextDecoder::begin(QTextStream *output) { _output = output; @@ -61,6 +49,7 @@ QList PlainTextDecoder::linePositions() const void PlainTextDecoder::decodeLine(const Character *const characters, int count, LineProperty /*properties*/) { Q_ASSERT(_output); + // TODO: This entire method is convoluted and needs a rewrite. if (_recordLinePositions && (_output->string() != nullptr)) { int pos = _output->string()->length(); @@ -69,28 +58,13 @@ void PlainTextDecoder::decodeLine(const Character *const characters, int count, // TODO should we ignore or respect the LINE_WRAPPED line property? - // If we should remove leading whitespace find the first non-space character int start = 0; - if (!_includeLeadingWhitespace) { - while (start < count && characters[start].isSpace()) { - start++; - } - } - int outputCount = count - start; if (outputCount <= 0) { return; } - // if inclusion of trailing whitespace is disabled then find the end of the - // line - if (!_includeTrailingWhitespace) { - while (outputCount > 0 && characters[start + outputCount - 1].isSpace()) { - outputCount--; - } - } - // find out the last technically real character in the line int realCharacterGuard = -1; for (int i = count - 1; i >= start; i--) { diff --git a/src/decoders/PlainTextDecoder.h b/src/decoders/PlainTextDecoder.h index cbd3683f5..112b96547 100644 --- a/src/decoders/PlainTextDecoder.h +++ b/src/decoders/PlainTextDecoder.h @@ -25,18 +25,6 @@ class PlainTextDecoder : public TerminalCharacterDecoder public: PlainTextDecoder(); - /** - * Set whether leading whitespace at the end of lines should be included - * in the output. - * Defaults to true. - */ - void setLeadingWhitespace(bool enable); - /** - * Set whether trailing whitespace at the end of lines should be included - * in the output. - * Defaults to true. - */ - void setTrailingWhitespace(bool enable); /** * Returns of character positions in the output stream * at which new lines where added. Returns an empty if setTrackLinePositions() is false or if @@ -53,8 +41,6 @@ public: private: QTextStream *_output; - bool _includeLeadingWhitespace; - bool _includeTrailingWhitespace; bool _recordLinePositions; QList _linePositions; diff --git a/src/filterHotSpots/TerminalImageFilterChain.cpp b/src/filterHotSpots/TerminalImageFilterChain.cpp index c5d7be2ae..d0ec26654 100644 --- a/src/filterHotSpots/TerminalImageFilterChain.cpp +++ b/src/filterHotSpots/TerminalImageFilterChain.cpp @@ -34,8 +34,6 @@ void TerminalImageFilterChain::setImage(const Character *const image, int lines, reset(); PlainTextDecoder decoder; - decoder.setLeadingWhitespace(true); - decoder.setTrailingWhitespace(true); // setup new shared buffers for the filters to process on _buffer.reset(new QString());