The whole challenge in implementing this feature, is to define the positions.
Yep.
From visual studio help
Use the Navigate Backward button to navigate to previously visited locations in the document, then use the Navigate Forward button to return afterwards. (You can also press CTRL + - to navigate backward and CTRL + SHIFT + - to navigate forward.) These buttons are particularly useful when using commands that take you far away from where you are currently working and you want to return to that location quickly. Examples of such commands are Incremental Search, Goto Line, Beginning of Document, End of Document, Pasting text or inserting file contents, and Go To Definition commands. The editor remembers locations when you move in a single command more than several lines away from where you are currently working, or if you edit in a particular location that is not adjacent to the last place you edited. The goal is to remember interesting locations so that you can recall where you have been working without remembering so many locations the feature is not useful (such as every character typed, or every line entering several new lines of code one right after the other).
It's hard to figure out exactly what VS strategy is but if I open a new file and put the cursor at the top, then hold the page down key down until I get to the end of the file, Ctrl + - takes me back up the screen one page at a time, even though I never stopped to look at anything. Yet if I start at the top of the screen and use cursor down for a while, Ctrl + - takes me back to the very top, no matter how long I paused anywhere during the cursor down sequence.
It's hard to decide "what is an interesting cursor position that you might want to go back to." So I made pause times and chunk sizes programmable and added a menu to allow staying within the same buffer or stepping from buffer to buffer and selecting one of two viewing granularities etc.
My strategy for stepping back and forwards along the list is different to VS. With VS, if your history is 1 2 3 4 5 and you're now at position 5 and do Ctrl + - twice, you're now at position 3 but the list is still 12345. Now if you go to some new position in the same file, say 6, then 7 then 8, - positions 6,7,8 seem to get inserted between 3 and 4. The list is no longer in the order that you visited the code.
Whereas for me, I have one command (xretrace_cursor) that takes you back to the last cursor position (always at the top of the list). Using xretrace_cursor repeatedly, alternates between the same two positions because if you're now at position A and you go to B, xretrace_cursor takes you back to position A because that's where you last were. If you want to actually step along the list, you use xretrace_cursor_steps, which runs an event loop and makes no changes to the list until you exit. The place where you exit is moved to the top of the list. When the event loop is active, the popup menu is useful as a reminder that special key-bindings are in effect.
If I want to step back several places in the list it's because I'm looking for something and I don't mind having to hit a special key (ESC or ENTER) to indicate when I've got to where I want to go.
Possibly I could add commands that allowed you to step along the list without an event loop and with no list re-ordering - not sure exactly how it would work though.
Graeme