Skip to content

Preview to Edit Mode #822

Closed
Closed

Description

@saran-ncsu

When we switch from Edit mode to Preview mode, Preview mode shows the text that corresponds to the cursor location in Edit mode. However, when we open a note in Preview mode, scroll through it, and then switch to Edit mode, it does not display the corresponding text window. Instead, it returns to the previous cursor location in Edit mode.

It is difficult to jump to the exact text location because there is no cursor position in Preview mode. However, it could open the corresponding section in Edit mode, similar to how scrolling in Preview mode while in Split mode scrolls the Edit mode window simultaneously.

Another implementation idea is that, in LaTeX, using SyncTeX, when we double-click or Cmd-click text in preview mode, it can jump to the exact location in edit mode.

Activity

  1. adibhanna commented on Sep 21, 2026

    @adibhanna
    Contributor

    Thanks for the clear report, and for the two suggestions; both went in. Reproduced in the built desktop app and fixed on the v2.54.0 branch in 60cc413. It ships with desktop 2.54.0 and the web client, and reaches the phones with the iOS and Android releases that adopt this core.

    Cause. Since #543, switching into Preview opens the reading view at the line you were editing, but the way back never looked at the reading view at all: Preview hides the editor with its caret in place, and the mode switch only showed it again. Which is why you always came back to the old cursor line, and to line 1 on a note you had opened straight into Preview.

    Fix. Your first suggestion is now the default. Every route out of Preview (Cmd+4, Cmd+5, the Edit / Split toggle, the palette, :view) reads what the reading view has on screen and, if your cursor's line is not in it, opens the editor with the section you were reading at the top and the cursor on its first line. If you only peeked at the rendering and the cursor's line is still on screen, nothing moves, so the "come back to the cursor" behaviour from #543 still holds. Into Split the reading view is re-aligned beside the editor as well, instead of drifting back to the editor's stale position.

    Your second suggestion, the SyncTeX-style jump: double-click any paragraph, heading, list item, quote or table in Preview and the note opens in Edit with the cursor on that block, kept at the same height it had on screen. In Split, the double-click brings the editor to the block and the reading view stays where it is. Links, embeds and diagrams keep their own double-click, and the image embed's "Edit this block" button now opens on the image's line too. Cmd-click was deliberately left out: in ZenNotes that chord already creates a linked note from the clicked text, and a modifier click on plain prose is hard to discover; the double-click matches what the VS Code markdown preview does.

    How to test once 2.54.0 is out (or on the branch: cd apps/desktop && npm run build, then npx electron apps/desktop/out/main/index.js from the repo root). Open a note longer than the window with the cursor at the top, press Cmd+6, scroll down a few screens, press Cmd+4.

    • Before: the editor comes back at the top of the note, cursor on line 1.
    • After: the section you were reading is at the top of the editor with the cursor on its first line. Cmd+5 instead opens Split with both halves on that section. Cmd+6 then Cmd+4 without scrolling in between leaves the cursor exactly where it was. And double-clicking a paragraph in Preview opens Edit with the cursor on that paragraph.
  2. saran-ncsu commented on Sep 22, 2026

    @saran-ncsu
    Author

    Just wanted to say you guys are killing it!! Love the app and the rate at which feedback is being implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions