xiota / geany-preview

Turns Geany into a markdown editor by providing a preview pane in the sidebar to show the formatting of several light-weight languages as they are edited. Supported document types include AsciiDoc, DocBook, Fountain, HTML, LaTeX, Markdown, MediaWiki, reStructuredText, Textile, and Txt2Tags.
GNU General Public License v3.0
12 stars 0 forks source link

no re-rendering of a visited document when tab-browsing #27

Open ralf3u opened 2 years ago

ralf3u commented 2 years ago

Actual behavior When tab-browsing with shortcuts or with the mouse, for example on a html-document, which already has been visited in the Geany session, and with an image on top of the webpage, then I can see a re-rendering in the preview (see the code down below), although there was no change. I can see the webpage re-rendering, because for a part second the text is there where the picture is located.

Expectation When tab-browsing with shortcuts or with the mouse from one document to another document, the preview should do some kind of hide the preview or keep the preview in memory. So, when the user is tab-browsing back in the editor to the document, the preview should appear right away, so without re-rendering.

Sidebar The issue appears also when tab-browsing in the sidebar.

Remark I think this would be a cool a feature. The content of the preview would appear then in light speed.

Test This is the test-document (a picture named 1.jpg need to be added in the same level of the html-document):

<!DOCTYPE html>
<head>
<title>test</title>
</head>
<body>
<br><br><br><br><br>
<img src="1.jpg" style="width:300px">
<br><br><br><br><br>
<div>1agsjdghjhsgjhgaskdgkagdaksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkag2daksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagd4aksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagda5ksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagdaksd6gaksdgh</div>
<div>agsjdghjhsgjhgaskdgka3gdaksdgaksdgh</div>
<body>
<html>

The settings in preview.conf are: snippet_html=false extra_css=extra-media.css

xiota commented 2 years ago

The update is b/c the document could have changed while the preview was hidden. Rather than do a lot of bookkeeping to track changes, it's easier to just update. There are also lots of times when the preview needs to be updated that are hard to detect, and it's worse to not update when needed than to update when not needed.

The preview uses the same webview for everything. So cannot keep the render in memory. Even if it could cache, the renders would frequently be out of date when documents are edited.

This is probably a wontfix unless I just happen across a more efficient way to handle it while reorganizing code.

ralf3u commented 2 years ago

The update is b/c the document could have changed while the preview was hidden.

Yes, but then a bar automatically appears on top of the editor, when the tab is again in focus. So, there is no need to check if the document was changed while the preview was hidden. This is the test:

Rather than do a lot of bookkeeping to track changes, it's easier to just update.

The test shows that a bookkeeping to track changes is not necessary.

There are also lots of times when the preview needs to be updated that are hard to detect, ...

I don't know what that means. Is there an example?