- enhancement: shortcut for goto definition/declaration

- change: ctrl+click symbol will goto definition, instead of got declaration
This commit is contained in:
Roy Qu 2022-03-19 15:33:15 +08:00
parent fc11f1223b
commit 12e772747c
3 changed files with 16 additions and 3 deletions

View File

@ -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 - 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: order for parameters generated by auto link may not correct
- fix: corresponding '>' not correctly removed when deleting '<' in #include line - 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 Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct - fix: calculation for code snippets's tab stop positions is not correct

View File

@ -1145,7 +1145,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
return; return;
} }
} else { } else {
gotoDeclaration(p); gotoDefinition(p);
return; return;
} }
} }
@ -3849,8 +3849,13 @@ void Editor::gotoDefinition(const BufferCoord &pos)
} }
QString filename; QString filename;
int line; int line;
filename = statement->definitionFileName; if (statement->definitionFileName == mFilename && statement->definitionLine == pos.Line) {
line = statement->definitionLine; filename = statement->fileName;
line = statement->line;
} else {
filename = statement->definitionFileName;
line = statement->definitionLine;
}
Editor* e = pMainWindow->editorList()->getEditorByFilename(filename); Editor* e = pMainWindow->editorList()->getEditorByFilename(filename);
if (e) { if (e) {
e->setCaretPositionAndActivate(line,1); e->setCaretPositionAndActivate(line,1);

View File

@ -2324,11 +2324,17 @@
<property name="text"> <property name="text">
<string>Goto Declaration</string> <string>Goto Declaration</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+Shift+G</string>
</property>
</action> </action>
<action name="actionGoto_Definition"> <action name="actionGoto_Definition">
<property name="text"> <property name="text">
<string>Goto Definition</string> <string>Goto Definition</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+G</string>
</property>
</action> </action>
<action name="actionFind_references"> <action name="actionFind_references">
<property name="text"> <property name="text">