Commit 3b182fa1 authored by Carlos Alves's avatar Carlos Alves Committed by Tomaz Canabrava
Browse files

Change a specific position at history

Needed to correct the history when columns size change
parent 155cedec
......@@ -47,6 +47,10 @@ public:
virtual void addLine(bool previousWrapped = false) = 0;
// modify history
virtual void setCellsVectorAt(int position, const QVector<Character> &cells) = 0;
virtual void setLineAt(int position, bool previousWrapped) = 0;
//
// FIXME: Passing around constant references to HistoryType instances
// is very unsafe, because those references will no longer
......
......@@ -79,3 +79,11 @@ void HistoryScrollFile::addLine(bool previousWrapped)
unsigned char flags = previousWrapped ? 0x01 : 0x00;
_lineflags.add(reinterpret_cast<char *>(&flags), sizeof(char));
}
void HistoryScrollFile::setCellsVectorAt(int , const QVector<Character> &)
{
}
void HistoryScrollFile::setLineAt(int , bool)
{
}
......@@ -34,6 +34,9 @@ public:
void addCells(const Character text[], int count) override;
void addLine(bool previousWrapped = false) override;
void setCellsVectorAt(int position, const QVector<Character> &cells) override;
void setLineAt(int position, bool previousWrapped) override;
private:
qint64 startOfLine(int lineno);
......
......@@ -51,3 +51,11 @@ void HistoryScrollNone::addCells(const Character [], int)
void HistoryScrollNone::addLine(bool)
{
}
void HistoryScrollNone::setCellsVectorAt(int , const QVector<Character> &)
{
}
void HistoryScrollNone::setLineAt(int , bool)
{
}
\ No newline at end of file
......@@ -32,6 +32,9 @@ public:
void addCells(const Character a[], int count) override;
void addLine(bool previousWrapped = false) override;
void setCellsVectorAt(int position, const QVector<Character> &cells) override;
void setLineAt(int position, bool previousWrapped) override;
};
}
......
......@@ -91,6 +91,21 @@ void CompactHistoryScroll::setMaxNbLines(unsigned int lineCount)
////qDebug() << "set max lines to: " << _maxLineCount;
}
void CompactHistoryScroll::setCellsVectorAt(int position, const TextLine &cells)
{
CompactHistoryLine *line = new(_blockList) CompactHistoryLine(cells, _blockList);
delete _lines.takeAt(position);
_lines.insert(position, line);
}
void CompactHistoryScroll::setLineAt(int position, bool previousWrapped)
{
CompactHistoryLine *line = _lines.at(position);
line->setWrapped(previousWrapped);
}
bool CompactHistoryScroll::isWrappedLine(int lineNumber)
{
Q_ASSERT(lineNumber < _lines.size());
......
......@@ -33,6 +33,8 @@ public:
void addLine(bool previousWrapped = false) override;
void setMaxNbLines(unsigned int lineCount);
void setCellsVectorAt(int position, const TextLine &cells) override;
void setLineAt(int position, bool previousWrapped) override;
private:
bool hasDifferentColors(const TextLine &line) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment