mirror of
https://github.com/zed-industries/zed.git
synced 2026-10-19 11:04:06 +00:00
## Summary Closes #64454 Going back (`ctrl-o` in Vim mode, the mouse back button, or the back button in the tab bar) after switching away from a markdown preview skipped the preview and landed on the tab before it. Panes record history entries when an item is deactivated, but only if the item adds itself: `Item::set_nav_history` and `Item::deactivated` default to doing nothing, and `MarkdownPreviewView` didn't implement either. The preview now stores its `ItemNavHistory` and pushes an entry when deactivated, the same way other items do. The entry carries no navigation data, so going back reactivates the preview without restoring its scroll position. If the preview has been closed, its entry is skipped, since it has no project path to reopen. In Vim mode, `ctrl-o`/`ctrl-i` were only bound for editors, so pressing them while the preview was focused opened the file dialog instead of navigating. They're now also bound in the `MarkdownPreview` context. ## Testing - Added `go_back_returns_to_preview_after_opening_another_file`. It opens a markdown file and its preview, opens another file, goes back, and asserts that the preview is active again. It fails without the fix. - Manually tested on Linux (KDE Wayland): open a markdown file, open its preview, open another file with the file finder, then go back with `ctrl-o` and with the tab bar's back button. Both return to the preview, and going forward returns to the other file. - In Vim mode, `ctrl-o` and `ctrl-i` from the focused preview now go back and forward instead of opening the file dialog. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] Tests cover the new or changed behavior. Release Notes: - Fixed navigating back to a markdown preview tab after switching to another file, and `ctrl-o`/`ctrl-i` in Vim mode opening the file dialog when the preview is focused. |
||
|---|---|---|
| .. | ||
| badge | ||
| fonts | ||
| icons | ||
| images | ||
| keymaps | ||
| prompts | ||
| settings | ||
| sounds | ||
| themes | ||