diff --git a/NEWS.md b/NEWS.md
index b32fc2e4..8f1a31ce 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,8 @@ Red Panda C++ Version 1.0.1
- enhancement: press alt to switch to column selection mode while selection by mouse dragging in editor
- fix: order for parameters generated by auto link may not correct
- fix: corresponding '>' not correctly removed when deleting '<' in #include line
+ - enhancement: shortcut for goto definition/declaration
+ - change: ctrl+click symbol will goto definition, instead of got declaration
Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index 22db58ff..78838df9 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -1145,7 +1145,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
return;
}
} else {
- gotoDeclaration(p);
+ gotoDefinition(p);
return;
}
}
@@ -3849,8 +3849,13 @@ void Editor::gotoDefinition(const BufferCoord &pos)
}
QString filename;
int line;
- filename = statement->definitionFileName;
- line = statement->definitionLine;
+ if (statement->definitionFileName == mFilename && statement->definitionLine == pos.Line) {
+ filename = statement->fileName;
+ line = statement->line;
+ } else {
+ filename = statement->definitionFileName;
+ line = statement->definitionLine;
+ }
Editor* e = pMainWindow->editorList()->getEditorByFilename(filename);
if (e) {
e->setCaretPositionAndActivate(line,1);
diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui
index f8346300..a5d2bec0 100644
--- a/RedPandaIDE/mainwindow.ui
+++ b/RedPandaIDE/mainwindow.ui
@@ -2324,11 +2324,17 @@
Goto Declaration
+
+ Ctrl+Shift+G
+
Goto Definition
+
+ Ctrl+G
+