Consider the following C document:
```
int foo(void)
{
return bar(123);
}
int bar(int n)
{
return n + 1;
}
```
**Scenario 1.** Place the cursor on line 3, column 12, and invoke *Go to Symbol
Definition*. The cursor jumps to line 6, column 0. Now invoke *Navigate back a
location*. The cursor jumps to 3,12 — just what you’d expect.
**Scenario 2.** Place the cursor on line 3, column 12, and invoke *Go to Symbol
Definition*. The cursor jumps to line 6, column 0. Now move the cursor manually
to line 8, column 15, and then invoke *Navigate back a location*. Again, the
cursor jumps to 3,12. Is this what you’d expect? Depends; but clearly there are
cases where you’d prefer to jump to 6,0 first. In addition, you can’t *Navigate
forward a location* to 8,15.
This PR changes *Navigate back a location* so that it first pushes the current
position onto the navqueue. This does not affect scenario 1, because the
navqueue’s `add_new_position` deduplicates positions at the head. But in
scenario 2, this has the effect that *Navigate back* takes you to 6,0 first. If
you want 3,12, it’s just one more *Navigate back* away. And you can *Navigate
forward* to 8,15 now.
I have realized over time that this is kind of a prerequisite for my PR #1114.
Otherwise it is very counter-intuitive that *Navigate back* does **not** take
you to the position you just pushed with *Remember location in history*.
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1537
-- Commit Summary --
* Push current position to navqueue before navigating back
-- File Changes --
M src/navqueue.c (8)
-- Patch Links --
https://github.com/geany/geany/pull/1537.patch
https://github.com/geany/geany/pull/1537.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1537