[FEATURE] File viewer: keep line position when toggling between source and preview modes

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 24, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Editing needs source mode (line numbers, exact positions); reading tables and diagrams needs preview mode. Today switching modes loses the line position, so a line number obtained in one mode is not usable in the other, and I must decide which mode to open in before I know what I need. Line information is simply dropped at the mode boundary. Desktop v2.1.237, Windows 11.

Proposed Solution

Preserve position across the toggle in both directions: source -> preview scrolls to the rendered element that corresponds to that source line (the way editor/preview scroll-sync works in common markdown editors), and preview -> source lands on the source line for the element on screen. Then a :line link can open in either mode and the position survives the switch - no need to pick a mode up front.

Alternative Solutions

Opening the same file twice (once per mode) and matching by eye; or reading markdown as raw source only and giving up rendered tables. Both are workarounds for information the app already has.

Priority

Medium - Would be very helpful

Feature Category

File operations

Use Case Example

  1. A receipt link opens a 5000-line markdown log at line 5342 in source mode - I confirm the diff is what I expected.
  2. The section contains a comparison table, so I toggle to preview to actually read it - and land at the top of the file, losing my place.
  3. I scroll/search to find the section again, read the table, then toggle back to source to fix a cell - and lose my place a second time.
  4. With scroll-sync, both toggles keep me on that section and the round trip costs nothing.

Additional Context

Filed alongside a companion request about markdown :line links opening in source mode. That one is the entry point; this one is what makes the two modes usable together - with both, the mode you open in stops mattering.

View original on GitHub ↗