Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Preview auto scrolls to same location your cursor is at in the editor #222

Closed
moorepants opened this issue Jun 5, 2016 · 12 comments
Labels

Comments

@moorepants
Copy link

With a long rst document I have to constantly scroll the preview pane to the area where I'm editing. It would be nice if the preview would track where you are editing and go to that spot on reload to prevent the user from having to manually scroll the preview window.

@mitya57
Copy link
Member

mitya57 commented Jun 11, 2016

We currently have synchronized scrolling for Markdown (since ReText 6.0), but it's not trivial to implement this for reStructuredText…

@crystalfp
Copy link

Sorry, but with 6.0.2 on Windows the live preview is not synchronized.
The "Enable synchronized scrolling for markdown" is checked, the Default markup is set to Markdown and my file has extension .md and is UTF-8 Markup.
Is there anything other that I have to check?
Thanks!
mario

@mitya57
Copy link
Member

mitya57 commented Nov 30, 2016

@crystalfp

Is there anything other that I have to check?

Yes. Is the WebKit renderer enabled? (Note that the official Qt installers no longer include a WebKit module, so you may need to build it manually…)

@crystalfp
Copy link

crystalfp commented Nov 30, 2016 via email

@mitya57
Copy link
Member

mitya57 commented Nov 30, 2016

What should I do to build it?

I do not use Windows, so I cannot give you the precise instructions. But you can probably follow instructions on this wiki page (and source code from the same repository). Note that in will take a lot of time (> 1 hour), lots of RAM (> 4 GB) and also some disk space (~ 10 GB).

We are investigating switching to Qt WebEngine (which is shipped with Qt), but that won't happen soon.

@crystalfp
Copy link

Sigh, too much work.
So I return to my trusted Markdown workflow: Notepad++ for writing and WriteMonkey for writing & rendering.
Anyway, thanks!
mario

@mitya57
Copy link
Member

mitya57 commented Dec 17, 2016

Sigh, too much work.

You can try to use the pre-compiled (MSVC 2015) qtwebkit binaries from /~https://github.com/annulen/webkit/releases/tag/qtwebkit-tp4. You will still need to compile the Python bindings yourself (but this is much easier to do).

Anyway, ReText is in no way officially supported on Windows, and on popular Linux distros both qtwebkit and its bindings are available from the repositories.

@thomashoddinott
Copy link

thomashoddinott commented Feb 23, 2021

We currently have synchronized scrolling for Markdown (since ReText 6.0), but it's not trivial to implement this for reStructuredText…

@mitya57 - Just checking to see where this is at. Is there any chance we're going to see a Enable synchronised scrolling for reStructuredText in the future?

I'm working with a lot of math blocks. With use webkit renderer enabled I'm able to see beautiful rendered previews and double check my equations, but as soon as I make an edit, my preview screen jumps back to the top, making ReText difficult to use.

I'm already comfortable with markdown + math blocks $$...$$ and use Typora for editing. As a workaround I export my documents from md --> rst, and then use ReText to apply finishing touches. However I'd rather work with rst documents in ReText, without this conversion procedure!

I haven't looked into code, but can't you just save the state of the scroll, and set it back after re-render?

@mitya57
Copy link
Member

mitya57 commented Feb 24, 2021

Hi @thomashoddinott!

Is there any chance we're going to see a Enable synchronised scrolling for reStructuredText in the future?

Unfortunately, I didn't have enough time for that yet. And there is also a technical problem: synchronized scrolling requires that the generated HTML contains line numbers information, and not all nodes provide this information: https://stackoverflow.com/q/58359284.

I'm working with a lot of math blocks. With use webkit renderer enabled I'm able to see beautiful rendered previews and double check my equations, but as soon as I make an edit, my preview screen jumps back to the top, making ReText difficult to use.

This problem can be fixed without implementing proper synchronized scrolling.

I have just pushed commit a2b4bef which should make it better. For me, it fixes jumping to top when I edit reStructuredText documents with math. Can you please test it?

@thomashoddinott
Copy link

Hi @mitya57,

I tested it today and it's working.

Thanks for your help.

@mitya57
Copy link
Member

mitya57 commented Mar 3, 2021

With the latest commit in pymarkups module, synchronized scrolling should be working with reStructuredText too (provided that WebKit or WebEngine renderer is used).

You can test it with the following command:

pip3 install --user --upgrade /~https://github.com/retext-project/pymarkups/archive/master.tar.gz

Any feedback is welcome!

@gbastien
Copy link

gbastien commented Oct 4, 2021

Hi,

just to say that I was looking why synch scrolling was not working with reStructuredText, I installed pymarkups as suggested here above and now, when enabling "webkit rendering" the auto scroll is working as expected.

Great tool!

Gauthier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants