diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs
index 9dc3624..67879a9 100644
--- a/SourceGen/MainController.cs
+++ b/SourceGen/MainController.cs
@@ -3192,18 +3192,38 @@ namespace SourceGen {
}
///
- /// Scrolls the code list so that the specified label is shown.
+ /// Scrolls the code list so that the specified label is shown. If the label can't
+ /// be found, nothing happens.
///
/// Label symbol.
- public void GoToLabel(Symbol sym) {
- int offset = mProject.FindLabelOffsetByName(sym.Label);
- if (offset >= 0) {
- // TODO(someday): jump to symbol line, not arstart, for address region pre-labels
- GoToLocation(new NavStack.Location(offset, 0, NavStack.GoToMode.JumpToCodeData),
- true);
+ public bool GoToSymbol(Symbol sym) {
+ bool found = false;
+
+ if (sym.SymbolSource == Symbol.Source.Platform ||
+ sym.SymbolSource == Symbol.Source.Project) {
+ // Look for an EQU line for the project or platform symbol.
+ for (int i = 0; i < mProject.ActiveDefSymbolList.Count; i++) {
+ if (mProject.ActiveDefSymbolList[i] == sym) {
+ int offset = LineListGen.DefSymOffsetFromIndex(i);
+ Debug.Assert(offset < 0);
+ GoToLocation(new NavStack.Location(offset, 0,
+ NavStack.GoToMode.JumpToCodeData), true);
+ found = true;
+ break;
+ }
+ }
} else {
- Debug.WriteLine("DClick symbol: " + sym + ": label not found");
+ // Just look for a matching label.
+ int offset = mProject.FindLabelOffsetByName(sym.Label);
+ if (offset >= 0) {
+ // TODO(someday):jump to symbol line, not arstart, for address region pre-labels
+ GoToLocation(new NavStack.Location(offset, 0, NavStack.GoToMode.JumpToCodeData),
+ true);
+ found = true;
+ }
}
+
+ return found;
}
public void SelectionChanged() {
diff --git a/SourceGen/WpfGui/MainWindow.xaml.cs b/SourceGen/WpfGui/MainWindow.xaml.cs
index 72c2eab..3996180 100644
--- a/SourceGen/WpfGui/MainWindow.xaml.cs
+++ b/SourceGen/WpfGui/MainWindow.xaml.cs
@@ -1888,8 +1888,10 @@ namespace SourceGen.WpfGui {
}
SymbolsListItem sli = (SymbolsListItem)item;
- // TODO: this should also work for project/platform symbols that have EQU directives
- mMainCtrl.GoToLabel(sli.Sym);
+ if (!mMainCtrl.GoToSymbol(sli.Sym)) {
+ // TODO(maybe): indicate failure with a sound
+ Debug.WriteLine("DClick symbol list: '" + sli.Sym.Label + "' not found");
+ }
//codeListView.Focus();
}