Commit 51280aa4 authored by Carlos Alves's avatar Carlos Alves Committed by Tomaz Canabrava
Browse files

Add getMaxLines to history

Add the getMaxLines function to return the maximum number of lines it
is alowed to compactHistoryScroll.
parent 02ba277d
......@@ -32,6 +32,7 @@ public:
// access to history
virtual int getLines() = 0;
virtual int getMaxLines() = 0;
virtual int getLineLen(int lineno) = 0;
virtual void getCells(int lineno, int colno, int count, Character res[]) = 0;
virtual bool isWrappedLine(int lineNumber) = 0;
......
......@@ -33,6 +33,11 @@ int HistoryScrollFile::getLines()
return _index.len() / sizeof(qint64);
}
int HistoryScrollFile::getMaxLines()
{
return _index.len() / sizeof(qint64);
}
int HistoryScrollFile::getLineLen(int lineno)
{
return (startOfLine(lineno + 1) - startOfLine(lineno)) / sizeof(Character);
......
......@@ -27,6 +27,7 @@ public:
~HistoryScrollFile() override;
int getLines() override;
int getMaxLines() override;
int getLineLen(int lineno) override;
void getCells(int lineno, int colno, int count, Character res[]) override;
bool isWrappedLine(int lineno) override;
......
......@@ -30,6 +30,11 @@ int HistoryScrollNone::getLines()
return 0;
}
int HistoryScrollNone::getMaxLines()
{
return 0;
}
int HistoryScrollNone::getLineLen(int)
{
return 0;
......
......@@ -26,6 +26,7 @@ public:
bool hasScroll() override;
int getLines() override;
int getMaxLines() override;
int getLineLen(int lineno) override;
void getCells(int lineno, int colno, int count, Character res[]) override;
bool isWrappedLine(int lineno) override;
......
......@@ -57,6 +57,11 @@ int CompactHistoryScroll::getLines()
return _lines.size();
}
int CompactHistoryScroll::getMaxLines()
{
return static_cast<int>(_maxLineCount);
}
int CompactHistoryScroll::getLineLen(int lineNumber)
{
if ((lineNumber < 0) || (lineNumber >= _lines.size())) {
......
......@@ -24,6 +24,7 @@ public:
~CompactHistoryScroll() override;
int getLines() override;
int getMaxLines() override;
int getLineLen(int lineNumber) override;
void getCells(int lineNumber, int startColumn, int count, Character buffer[]) override;
bool isWrappedLine(int lineNumber) override;
......
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