Match the cursor position between Editing and Reading Views

When we’re writing a long page in Editing View and then switch to Reading View, Obsidian ignores where we’re working and does not scroll the page to anywhere that would make sense. It’s rather disorienting. And also frustrating when we are trying to refine our product by going back and forth between views.

Obsidian doesn’t even track our cursor position and view reliably when we have a linked tab “split-right” opened in Reading View.

Steps to reproduce

  1. Open the sandbox Help Vault
  2. Reduce the Obsidian window size so it’s maybe half your screen size (the bug is more pronounced when there’s less screen real estate)
  3. Open the Format your notes page
  4. Scroll down to the last section for Mermaid Diagrams
  5. Just above the ![[Diagram]] embed link, type in some words
  6. Switch to Reading View.

Notice that the line you’re working on is nowhere in view.

This can also be tested with a linked tab open where one tab is in Editing View and the linked tab is in Reading View.

What’s also bad is that when we switch back to Editing View, Obsidian inconsistently decides to try to either scroll to roughly the position of the Reading View or it remembers where you were typing last and goes there. But that behavior is not consistent. Even on the same system, during the same session, it often “changes its mind” about where to scroll back to when switching to between views.

This inconsistency feels extra buggy. If the app is going to be wrong, at least be consistently wrong!

When I fiddle with it and keep going back and forth between views, Obsidian seems to eventually decide to bring the cursor into view more consistently when going back to Editing View. But for me, it rarely does this the first time when I’m deep into a long document.

Expected result

In order of importance, Reading and Editing Views should be aligned based on:

  1. The cursor position in the document.
    (ex. when a linked view is open in a “split-right” position, the line being edited should be exactly aligned in both views.)
  2. The cursor position relative to the open window.
    (ex. 1/2 way down vs. 3/4 way down.)

Actual result

Editing and Reading Views are opened to inconsistent and disorienting page locations, not necessarily related to the scroll position we had chosen prior to the view switch.

Environment

  • Operating system:

Windows 10 Home 10.0.19044

  • Debug info:

SYSTEM INFO:
Obsidian version: v1.1.16
Installer version: v1.1.9
Operating system: Windows 10 Home 10.0.19044
Login status: logged in
Catalyst license: insider
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

Video recording of the bug attached, to show what I’m seeing.

Ahh, since we can’t attach videos in this forum, here’s the screen capture on our Discord.

I bet solving this bug would also address this feature request from a while back.

4 Likes

Yes, please. This is a constant problem for me.

2 Likes

There are a couple of issue at play here.

Reading view alignment does not have “line granularity”. Reading view has roughly a markdown block granularity. You can’t jump to a specific line. A line in the editor may be mapped to (the beginning of) a big block and this will create jumps. This is unlikely to change but you can open a FR.

Obsidian is currently architected to (try to) keep the top of editor and reader aligned. Not middle of the document, nor the cursor position. (This is covered by the other FR you linked)