Skip to content

Remember position in document when switching between files/tabs #2672

Closed

Description

@tehmasterer

Description

When you switch between another open document via tabs and return to the previous document, the area you were viewing is reset to the location of the mouse cursor.

Steps to reproduce

  1. Open document A & B, each in their own tab.
  2. Scroll halfway down document A, then switch to document B.
  3. Return to document A to find the place in the document you were viewing, has been reset to the mouse cursor. This also affects the position of the Table of Contents.

Expected behavior:

Remember the position in the document where I was viewing. Notepad++ and VS Code do this by default, along with web browsers, word processors, etc.

Actual behavior:

Switching tabs resets the location to the mouse cursor. It also moves the Table of Contents which is annoying.

Versions

  • Mark Text version: v0.16.3
  • Operating system: Windows 10 Pro

Activity

  1. jhult commented on Dec 5, 2023

    @jhult

    It would be nice to have the scroll position saved when switching tabs.

  2. Jocs commented on Jul 2, 2026

    @Jocs
    Member

    Thanks for the suggestion! This is now implemented in current MarkText: each open tab remembers its scroll position, and switching back to a tab restores where you were viewing (the restore even handles documents that haven't fully re-rendered yet, so it won't clamp to the top). You can see the save-on-scroll and restore-on-tab-switch logic in packages/desktop/src/renderer/src/components/editorWithTabs/editor.vue and the editor store. The active Table of Contents entry follows the restored scroll position as well. Closing as implemented, but if you still see the position reset on a recent build, please reopen with your version and a short repro and we'll take another look.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions