- Fix: Can't goto definition/declaration into files that not saved.

This commit is contained in:
Roy Qu 2024-02-20 10:31:12 +08:00
parent e794f9785c
commit f0c01e03aa
3 changed files with 5 additions and 3 deletions

View File

@ -42,6 +42,7 @@ Red Panda C++ Version 2.26
- Enhancement: add qmake variable to control preference of UTF-8 compatible OpenConsole.exe on Windows. - Enhancement: add qmake variable to control preference of UTF-8 compatible OpenConsole.exe on Windows.
- Enhancement: add Windows arm64 package. - Enhancement: add Windows arm64 package.
- Fix: Force to use debug server when debugging with lldb-mi to fix input/output on Windows. - Fix: Force to use debug server when debugging with lldb-mi to fix input/output on Windows.
- Fix: Can't goto definition/declaration into files that not saved.
Red Panda C++ Version 2.25 Red Panda C++ Version 2.25

View File

@ -1373,7 +1373,6 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
QString filename = mParser->getHeaderFileName(mFilename,s); QString filename = mParser->getHeaderFileName(mFilename,s);
pMainWindow->openFile(filename); pMainWindow->openFile(filename);
return; return;
} else if (mParser->enabled()) { } else if (mParser->enabled()) {
gotoDefinition(p); gotoDefinition(p);
return; return;
@ -4674,7 +4673,9 @@ void Editor::gotoDefinition(const QSynedit::BufferCoord &pos)
filename = statement->definitionFileName; filename = statement->definitionFileName;
line = statement->definitionLine; line = statement->definitionLine;
} }
Editor *e = pMainWindow->openFile(filename); Editor *e = pMainWindow->editorList()->getOpenedEditorByFilename(filename);
if (!e)
e = pMainWindow->openFile(filename);
if (e) { if (e) {
e->setCaretPositionAndActivate(line,1); e->setCaretPositionAndActivate(line,1);
} }

View File

@ -50,7 +50,7 @@ class CppSyntaxer: public Syntaxer
rsDocstring, rsDocstring,
rsStringEscapeSeq, rsStringEscapeSeq,
rsRawString, rsSpace,rsRawStringNotEscaping,rsRawStringEnd,rsChar, rsRawString, rsSpace,rsRawStringNotEscaping,rsRawStringEnd,rsChar,
rsDefineIdentifier, rsDefineRemaining rsDefineIdentifier, rsDefineRemaining,
}; };
public: public: