forked from qt-creator/qt-creator
One step to being able to jump back in a senseful way...
This commit is contained in:
@@ -959,7 +959,7 @@ void BaseTextEditor::setTextCursor(const QTextCursor &cursor)
|
|||||||
slotSelectionChanged();
|
slotSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::gotoLine(int line, int column, bool saveNewPosition)
|
void BaseTextEditor::gotoLine(int line, int column)
|
||||||
{
|
{
|
||||||
const int blockNumber = line - 1;
|
const int blockNumber = line - 1;
|
||||||
const QTextBlock &block = document()->findBlockByNumber(blockNumber);
|
const QTextBlock &block = document()->findBlockByNumber(blockNumber);
|
||||||
@@ -977,7 +977,6 @@ void BaseTextEditor::gotoLine(int line, int column, bool saveNewPosition)
|
|||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
centerCursor();
|
centerCursor();
|
||||||
}
|
}
|
||||||
if (saveNewPosition)
|
|
||||||
saveCurrentCursorPositionForNavigation();
|
saveCurrentCursorPositionForNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,9 +1114,11 @@ bool BaseTextEditor::restoreState(const QByteArray &state)
|
|||||||
stream >> hval;
|
stream >> hval;
|
||||||
stream >> lval;
|
stream >> lval;
|
||||||
stream >> cval;
|
stream >> cval;
|
||||||
gotoLine(lval, cval, false);
|
d->m_lastCursorChangeWasInteresting = false; // avoid adding last position to history
|
||||||
|
gotoLine(lval, cval);
|
||||||
verticalScrollBar()->setValue(vval);
|
verticalScrollBar()->setValue(vval);
|
||||||
horizontalScrollBar()->setValue(hval);
|
horizontalScrollBar()->setValue(hval);
|
||||||
|
saveCurrentCursorPositionForNavigation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ public:
|
|||||||
|
|
||||||
// ITextEditor
|
// ITextEditor
|
||||||
|
|
||||||
void gotoLine(int line, int column = 0, bool saveNewPosition = true);
|
void gotoLine(int line, int column = 0);
|
||||||
|
|
||||||
int position(
|
int position(
|
||||||
ITextEditor::PositionOperation posOp = ITextEditor::Current
|
ITextEditor::PositionOperation posOp = ITextEditor::Current
|
||||||
|
|||||||
Reference in New Issue
Block a user