forked from qt-creator/qt-creator
AnalyzerBase: Fix opening links with Windows drive letters
Change-Id: Iba365f9abeff2573296295e50a6100cc480374b4 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -203,11 +203,13 @@ void DetailedErrorDelegate::onVerticalScroll()
|
|||||||
// Expects "file://some/path[:line[:column]]" - the line/column part is optional
|
// Expects "file://some/path[:line[:column]]" - the line/column part is optional
|
||||||
void DetailedErrorDelegate::openLinkInEditor(const QString &link)
|
void DetailedErrorDelegate::openLinkInEditor(const QString &link)
|
||||||
{
|
{
|
||||||
const QString pathLineColumn = link.mid(int(sizeof("file://")) - 1);
|
const QString linkWithoutPrefix = link.mid(strlen("file://"));
|
||||||
const QChar separator = QLatin1Char(':');
|
const QChar separator = QLatin1Char(':');
|
||||||
const QString path = pathLineColumn.section(separator, 0, 0);
|
const int lineColon = linkWithoutPrefix.indexOf(separator, /*after drive letter + colon =*/ 2);
|
||||||
const int line = pathLineColumn.section(separator, 1, 1).toInt();
|
const QString path = linkWithoutPrefix.left(lineColon);
|
||||||
const int column = pathLineColumn.section(separator, 2, 2).toInt();
|
const QString lineColumn = linkWithoutPrefix.mid(lineColon + 1);
|
||||||
|
const int line = lineColumn.section(separator, 0, 0).toInt();
|
||||||
|
const int column = lineColumn.section(separator, 1, 1).toInt();
|
||||||
Core::EditorManager::openEditorAt(path, qMax(line, 0), qMax(column, 0));
|
Core::EditorManager::openEditorAt(path, qMax(line, 0), qMax(column, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user