forked from qt-creator/qt-creator
Utils: Adjust column numbers affected by convertPosition change
convertPosition change was introduced in 931ec39f64.
It changed 0-based column to 1-based which is how it
naturally is in Qt Creator.
This fixed some usages but broke many more. This is an
attempt to fix the remaining use cases.
Fixes CppEditor auto-tests.
Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -3104,14 +3104,14 @@ bool TextEditorWidget::restoreState(const QByteArray &state)
|
||||
int version;
|
||||
int vval;
|
||||
int hval;
|
||||
int lval;
|
||||
int cval;
|
||||
int lineVal;
|
||||
int columnVal;
|
||||
QDataStream stream(state);
|
||||
stream >> version;
|
||||
stream >> vval;
|
||||
stream >> hval;
|
||||
stream >> lval;
|
||||
stream >> cval;
|
||||
stream >> lineVal;
|
||||
stream >> columnVal;
|
||||
|
||||
if (version >= 1) {
|
||||
QList<int> collapsedBlocks;
|
||||
@@ -3137,7 +3137,8 @@ bool TextEditorWidget::restoreState(const QByteArray &state)
|
||||
}
|
||||
|
||||
d->m_lastCursorChangeWasInteresting = false; // avoid adding last position to history
|
||||
gotoLine(lval, cval);
|
||||
// line is 1-based, column is 0-based
|
||||
gotoLine(lineVal, columnVal - 1);
|
||||
verticalScrollBar()->setValue(vval);
|
||||
horizontalScrollBar()->setValue(hval);
|
||||
d->saveCurrentCursorPositionForNavigation();
|
||||
|
||||
Reference in New Issue
Block a user