zed/assets
Kashish Sahu 9f94d13160
markdown_preview: Fix navigating back to the preview tab (#65299)
## 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.
2026-10-09 08:37:05 +00:00
..
badge Adjust Zed badge (#35294) 2025-07-29 15:09:31 -04:00
fonts Use semibold (#47725) 2026-01-27 08:50:52 -07:00
icons Fix forward Delete key icon (#65037) 2026-10-02 08:11:03 +00:00
images Add announcement banner for Delta (#64963) 2026-09-30 12:03:51 +00:00
keymaps markdown_preview: Fix navigating back to the preview tab (#65299) 2026-10-09 08:37:05 +00:00
prompts A couple new inline assistant tests (#45049) 2025-12-17 13:02:03 -08:00
settings Make mermaid diagram font family configurable (#63430) 2026-10-06 12:47:57 +00:00
sounds call: Play a different sound when a guest joins (#38987) 2025-09-27 09:20:55 -04:00
themes Fix parameter colors for gruvbox themes (#61983) 2026-07-31 10:27:51 +00:00