Commit 4e6c8e38 authored by Kai Koehne's avatar Kai Koehne

CppOutline: Fix navigation to e.g. enum members

Use symbol->line() && symbol->column() instead going through the
translation unit. That's also what CppEditor does in
jumpToOutlineElement().
parent 5aea9302
......@@ -120,19 +120,16 @@ void CppOutlineWidget::updateSelectionInText(const QItemSelection &selection)
CPlusPlus::Symbol *symbol = m_model->symbolFromIndex(index);
if (symbol) {
m_blockCursorSync = true;
unsigned line, column;
m_model->document()->translationUnit()->getPosition(symbol->startOffset(), &line, &column);
if (debug)
qDebug() << "CppOutline - moving cursor to" << line << column - 1;
qDebug() << "CppOutline - moving cursor to" << symbol->line() << symbol->column() - 1;
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->cutForwardNavigationHistory();
editorManager->addCurrentPositionToNavigationHistory();
// line has to be 1 based, column 0 based!
m_editor->gotoLine(line, column - 1);
m_editor->gotoLine(symbol->line(), symbol->column() - 1);
m_blockCursorSync = false;
}
}
......
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