Skip to content

Markdown Preview does not preserve scroll position #22995

Closed

Description

  • VSCode Version: 1.10.2
  • OS Version: Ubuntu 14.04

Steps to Reproduce:

  1. Open a Markdown file.
  2. Open the preview (ctrl+shift+v).
  3. Close the Markdown file tab (not the preview).
  4. Scroll a few times in the preview tab.
  5. Open any other file.
  6. Go to the preview tab again. Notice that the scrollbar is reset to top.

My suggestion is that the scroll position of Markdown preview tab should follow its corresponding raw Markdown tab's only if the raw Markdown tab is present. If it is not present, the preview tab should preserve the last scroll position.

Activity

  1. slfuqua commented on Apr 9, 2017

    @slfuqua
    • VSCode Version: 1.11.1
    • OS Version: Ubuntu 14.04

    Steps to Reproduce:

    1. Open a Markdown file, place cursor anywhere in file other than the top
    2. Open the Preview (ctrl+shift+v).

    More generally than above, the "Preview" tool now (unlike previously) always resets to the top of the markdown file when you open it or go to its tab and it refreshes (or you press ctrl+shift+v). It no longer goes to the current edit (cursor) location in the raw file. It is inconvenient to repeatedly scroll down to the current edit location in long files, to preview the changes.

    I'm pretty sure I skipped a couple of version updates until I installed 1.11.1 today (4/9/2017), so I'm not sure when the behavior changed, but it was fairly recent, my version was not too outdated, no more than two or three updates.

  2. jdim commented on Apr 9, 2017

    @jdim

    Same behavior

    • VSCode Version: 1.12.0-insider
    • OS Version: Ubuntu 16.04
  3. rebornix commented on Apr 11, 2017

    @rebornix
    Contributor

    Re #22279, run into this issue while following the guidance of the project.

  4. mjbvz commented on Apr 11, 2017

    @mjbvz
    Contributor

    Peng Lyu (@rebornix) Can we try debugging through the issue on your machine this afternoon?

  5. chaskim commented on Apr 18, 2017

    @chaskim

    I have the same problem as outlined by Sherrie L. Fuqua (@slfuqua).

    • VS Code 1.11.2
    • macOS 10.11.6

    It worked okay in earlier versions of VS Code (I believe it worked okay in 1.10.x).

  6. mjbvz commented on Apr 19, 2017

    @mjbvz
    Contributor

    For anyone seeing this problem, #24985 just added some basic logging to help investigate. The change be in the next insiders build. Once that is released, please download it and:

    • Set "markdown.trace": "verbose"
    • Reproduce the issue
    • Go to the output pane and share the output from the Markdown section

    This should help me investigate what may be going wrong here

  7. chaskim commented on Apr 19, 2017

    @chaskim

    Matt Bierner (@mjbvz) Thanks very much for looking into this. Below is my output after setting markdown.trace to verbose in VS Code 1.12.0-insider. The first entry is when I click somewhere in the middle of the markdown document. The second is when I use the preview option (which still shows the very top of the document instead of where my cursor was in the actual markdown document).

    [Log - 11:43:07 AM] updatePreviewForSelection
    {
      "markdownFile": "markdown:/Users/Charles/Develop/Personnel/BlocNotes/aurelia-snippets.md.rendered?file%3A%2F%2F%2FUsers%2FCharles%2FDevelop%2FPersonnel%2FBlocNotes%2Faurelia-snippets.md"
    }
    [Log - 11:43:10 AM] provideTextDocumentContent
    {
      "previewUri": "markdown:/Users/Charles/Develop/Personnel/BlocNotes/aurelia-snippets.md.rendered?file%3A%2F%2F%2FUsers%2FCharles%2FDevelop%2FPersonnel%2FBlocNotes%2Faurelia-snippets.md",
      "source": "file:///Users/Charles/Develop/Personnel/BlocNotes/aurelia-snippets.md",
      "line": 0,
      "scrollPreviewWithEditorSelection": true,
      "scrollEditorWithPreview": true,
      "doubleClickToSwitchToEditor": true
    }
    

    I see that the "line" entry is zero. Maybe the issue is related to that?

  8. added
    bugIssue identified by VS Code Team member as probable bug
    on Apr 19, 2017
  9. mjbvz commented on Apr 19, 2017

    @mjbvz
    Contributor

    Thanks chaskim!

    From your log, I think there's a bug in the markdown preview where using Open Preview instead of Open Preview to Side causes the initial line not to be set. Looking into a fix

  10. isidorn commented on May 8, 2017

    @isidorn

    Potentially dup of #22420

  11. added this to the May 2017 milestone on May 11, 2017
  12. added a commit that references this issue on May 17, 2017
    dea44c8
  13. locked and limited conversation to collaborators on Nov 18, 2017
  14. added a commit that references this issue on Sep 6, 2026
    086e15a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugmarkdown-extThe Markdown extension: language features and previewplan-itemVS Code - planned item for upcomingverifiedVerification succeededwebviewWebview issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions