1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +00:00

Fix double-click jump to local var with annotation

Double-clicking the opcode of an instruction that references a
local variable (e.g. "LDA ]foo") moves the selection to the line
that declares the variable.  This wasn't working in the case where
the local var was annotated (e.g. "LDA ]foo?").
This commit is contained in:
Andy McFadden 2020-01-23 11:13:37 -08:00
parent c535201884
commit d4b97007df

View File

@ -2713,6 +2713,16 @@ namespace SourceGen {
return;
}
// Find the actual symbol definition.
LocalVariableTable lvTable = mProject.LvTables[varOffset];
DefSymbol foundSym = lvTable.GetByLabel(symRef.Label);
if (foundSym == null) {
// shouldn't be possible
Debug.WriteLine("Did not find " + symRef.Label + " in expected table");
Debug.Assert(false);
return;
}
// We have the offset to which the local variable table is bound. We need to
// walk down until we find the variable definitions, and find the line with the
// matching symbol.
@ -2720,7 +2730,10 @@ namespace SourceGen {
// We're comparing to the formatted strings -- safer than trying to find the symbol
// in the table and then guess at how the table arranges itself for display -- so we
// need to compare the formatted form of the label.
string cmpStr = mFormatter.FormatVariableLabel(symRef.Label);
//
// We need to use GenerateDisplayLabel() because the symbol might have an annotation.
string cmpStr = mFormatter.FormatVariableLabel(
foundSym.GenerateDisplayLabel(mFormatter));
int lineIndex = CodeLineList.FindLineIndexByOffset(varOffset);
while (lineIndex < mProject.FileDataLength) {
LineListGen.Line line = CodeLineList[lineIndex];