Commit 6c13ce05 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

TextEditor: Fallback to last line when input line exceeds the document

Task-number: QTCREATORBUG-14782
Change-Id: I7ead94a132207ccaae661cb6aceff5387d11b818
Reviewed-by: default avatarRobert Loehning <>
Reviewed-by: default avatarEike Ziller <>
parent 93e0ffa9
......@@ -2513,7 +2513,7 @@ void TextEditorWidget::doSetTextCursor(const QTextCursor &cursor)
void TextEditorWidget::gotoLine(int line, int column, bool centerLine)
d->m_lastCursorChangeWasInteresting = false; // avoid adding the previous position to history
const int blockNumber = line - 1;
const int blockNumber = qMin(line, document()->blockCount()) - 1;
const QTextBlock &block = document()->findBlockByNumber(blockNumber);
if (block.isValid()) {
QTextCursor cursor(block);
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