Core: Use restrictions on character count instead of line counts

Assume lines with an average of 100 characters for the transition
and use the character limit already in two cases.

Change-Id: I43316d51d7d5017aa413d6c910d3784a14237e9f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Eike Ziller
2018-09-25 13:58:24 +02:00
committed by hjk
parent 65ea6f8e83
commit 70e5cab569
9 changed files with 45 additions and 42 deletions

View File

@@ -159,7 +159,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
m_outputWindow->setWindowIcon(Icons::WINDOW.icon());
m_outputWindow->setReadOnly(true);
m_outputWindow->setUndoRedoEnabled(false);
m_outputWindow->setMaxLineCount(Core::Constants::DEFAULT_MAX_LINE_COUNT);
m_outputWindow->setMaxCharCount(Core::Constants::DEFAULT_MAX_CHAR_COUNT);
// Let selected text be colored as if the text edit was editable,
// otherwise the highlight for searching is too light
@@ -226,7 +226,7 @@ void CompileOutputWindow::updateZoomEnabled()
void CompileOutputWindow::updateFromSettings()
{
m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
m_outputWindow->setMaxLineCount(ProjectExplorerPlugin::projectExplorerSettings().maxBuildOutputLines);
m_outputWindow->setMaxCharCount(ProjectExplorerPlugin::projectExplorerSettings().maxBuildOutputChars);
}
bool CompileOutputWindow::hasFocus() const
@@ -323,10 +323,11 @@ void CompileOutputWindow::registerPositionOf(const Task &task, int linkedOutputL
{
if (linkedOutputLines <= 0)
return;
int blocknumber = m_outputWindow->document()->blockCount();
if (blocknumber > m_outputWindow->maxLineCount())
const int charNumber = m_outputWindow->document()->characterCount();
if (charNumber > m_outputWindow->maxCharCount())
return;
const int blocknumber = m_outputWindow->document()->blockCount();
const int startLine = blocknumber - linkedOutputLines + 1 - skipLines;
const int endLine = blocknumber - skipLines;