Commit 222b4fab authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Don't try to jump to unresolved included files

It popped up an error saying the file couldn't be found. Better not show
a link at all.
parent 145c1fb9
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "Macro.h" #include "Macro.h"
#include <QByteArray> #include <QByteArray>
#include <QFileInfo>
#include <QList> #include <QList>
#include <QMap> #include <QMap>
#include <QSharedPointer> #include <QSharedPointer>
...@@ -199,6 +200,9 @@ public: ...@@ -199,6 +200,9 @@ public:
unsigned line() const unsigned line() const
{ return _line; } { return _line; }
bool resolved() const
{ return QFileInfo(_fileName).isAbsolute(); }
}; };
class MacroUse: public Block { class MacroUse: public Block {
......
...@@ -605,7 +605,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor, ...@@ -605,7 +605,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
// Handle include directives // Handle include directives
const unsigned lineno = cursor.blockNumber() + 1; const unsigned lineno = cursor.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) { foreach (const Document::Include &incl, doc->includes()) {
if (incl.line() == lineno) { if (incl.line() == lineno && incl.resolved()) {
link.fileName = incl.fileName(); link.fileName = incl.fileName();
link.pos = cursor.block().position(); link.pos = cursor.block().position();
link.length = cursor.block().length(); link.length = cursor.block().length();
......
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