typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

Add back/forward functionality for internal navigation. #1574

Open gandalfsaxe opened 6 years ago

gandalfsaxe commented 6 years ago

It would be great to have back/forward functionality when you follow internal links in a document, i.e. click a crossref link to a chapter, click a link in the outline etc.

This is similar to #1154, but this is for internal navigation, not external navigation between files.

flamewave000 commented 4 years ago

This would also be great if it can be triggered by shortcuts. I use the back button on my mouse all the time when using browsers, and it'd be great to be able to use my mouse back button to jump back to through my navigation history.

gandalfsaxe commented 4 years ago

To add to that, FYI the canonical back shortcut on Mac is ⌘[ (forward is ⌘]).

IgorBuchelnikov commented 3 years ago

Some impementation details.

It is needed to save the history of text cursor positions and allow to move over it. A new history entry is created when 1) mouse click on the document text 2) transition through the document outline

The current history entry changes when 1) a keyboard button is pressed (arrow key, symbol key) 3) mouse click on the document text within a current paragraph

Text cursor position history is linear, not tree-like. If a new history entry is created when the current entry is not last in the history, all history entries in the tail are removed (are replaced by the new history entry).