Remove unused code

There's no where that this code is used and it adds complexity to the
decodeLine method in PlainTextDecoder.  Also note that the removing
leading spaces didn't work.
This commit is contained in:
Kurt Hindenburg
2025-03-01 16:56:59 -05:00
committed by Christoph Cullmann
parent dc598f21fd
commit 64e070c6df
3 changed files with 1 additions and 43 deletions

View File

@@ -18,23 +18,11 @@ using namespace Konsole;
PlainTextDecoder::PlainTextDecoder()
: _output(nullptr)
, _includeLeadingWhitespace(true)
, _includeTrailingWhitespace(true)
, _recordLinePositions(false)
, _linePositions(QList<int>())
{
}
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<int> 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--) {

View File

@@ -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<int> _linePositions;

View File

@@ -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());