mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
1ded60a660
Happy New Years! This PR is a second take at https://github.com/zed-industries/zed/pull/38127 (cc @ConradIrwin) This PR is significantly less complicated than the last attempt: while we still keep our data on the `NavigationHistory` object, we no longer tightly integrate it with the existing back/forward "browser history." Instead, we keep our own stack of `(origin, target)` pairs (in a struct to make it easy to extend with e.g., tag names in the future). The PR is split into two separable commits. Most of the implementation is in the second commit, which: - Defines the stack data structure - Implements `pane::GoToOlderTag` and `pane::GoToNewerTag` in terms of the stack - Hooks into `navigate_to_hover_links` to push tag stack entries This last bit is the most fiddly. The core challenge is that we need to keep track of the `origin` location and calculate the `target` location across three codepaths that might involve creating a new editor and/or splitting the pane. One thing in particular I found difficult was that an editor's `nav_history` (an `ItemNavHistory`) seems to be populated asynchronously. Instead of relying on it, I decided in this code to make my own `ItemNavHistory`. I briefly tried to refactor the code in question, but it seemed like it would significantly increase the scope of the change. I prefer this all-in-one tracking centered around `navigate_to_hover_links ` to the `start/finish` approach taken in https://github.com/zed-industries/zed/commit/b69a2ea200561de9de0edf4d0c4428ee887fb918 because I find it easier to convince myself that the right data is being populated at the right times. Of course, let me know if you think there's a better solution. Closes #14206 Release Notes: - ??? I don't know what to write here! Suggestions welcome