Commit 212f18be authored by con's avatar con
Browse files

Avoid messing up navigation history from the vcs editors.

Reviewed-by: Friedemann Kleint
parent b4367cb9
......@@ -293,7 +293,7 @@ TextEditor::BaseTextEditorEditable *VCSBaseEditor::createEditableInterface()
// Diff: set up diff file browsing
VCSBaseDiffEditorEditable *de = new VCSBaseDiffEditorEditable(this, d->m_parameters);
QComboBox *diffBrowseComboBox = de->diffFileBrowseComboBox();
connect(diffBrowseComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDiffBrowse(int)));
connect(diffBrowseComboBox, SIGNAL(activated(int)), this, SLOT(slotDiffBrowse(int)));
editable = de;
} else {
editable = new VCSBaseEditorEditable(this, d->m_parameters);
......@@ -337,10 +337,15 @@ void VCSBaseEditor::slotDiffBrowse(int index)
// goto diffed file as indicated by index/line number
if (index < 0 || index >= d->m_diffSections.size())
return;
const int lineNumber = d->m_diffSections.at(index);
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->addCurrentPositionToNavigationHistory();
gotoLine(lineNumber + 1, 0); // TextEdit uses 1..n convention
const int lineNumber = d->m_diffSections.at(index) + 1; // TextEdit uses 1..n convention
// check if we need to do something, especially to avoid messing up navigation history
int currentLine, currentColumn;
convertPosition(position(), &currentLine, &currentColumn);
if (lineNumber != currentLine) {
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->addCurrentPositionToNavigationHistory();
gotoLine(lineNumber, 0);
}
}
// Locate a line number in the list of diff sections.
......
Supports Markdown
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