Closed Discookie closed 2 years ago
That is a very good example for testing overlapping ranges, thank you! Fixed it so it prioritizes exact matches over matching the step's range, but it still doesn't quite work in this case.
The issue is that the 2nd (calling foo) and 5th (returning from foo) steps have the exact same location. The extension has no memory of which step it's supposed to be on, so stepping backwards always steps from Calling and forwards from Returning. Dealing with these exact overlaps is better fit for a separate issue I believe.
It solves a simpler version of the issue:
main.cpp
#include "main.h"
int main() {
return foo(0);
}
main.h
#ifndef MAIN_H
#define MAIN_H
int foo(int param) {
return 1 / param;
}
#endif
In this case, navigation only worked inside main.h. Also fixes range-checks in general, so the cursor can be anywhere in a report's range and the navigation will work.
Another added fix is for overlapping ranges: ( | is where the cursor jumps when you step to the repr. step.)
\-|----/ Step 1
|-/ Step 2
| Cursor, stepping backwards.
Before, stepping backwards from step 2 skipped range 1, and jumped to step 1's previous step. Now when the cursor is on step 2's exact position, that one will get prioritized.
Created #86 for the remaining case.
Fixes #71.