publicimageltd / delve

Delve into your org-roam zettelkasten
GNU General Public License v3.0
189 stars 8 forks source link

Node with invisible sublist disappears after previewing it #12

Closed cheerio-pixel closed 2 years ago

cheerio-pixel commented 2 years ago

To be more specific, if I press return with a node that have ellipsis then the whole node will dissapear leaving only the ellipis, if there was a node of the same level in the previous line pressing return will also cause the same problem.

So far i found that the problem has to do with ewoc-invalidate inside the lister-refresh-at that is in delve--key--toggle-preview which has some problems updating the node at point having an invisible node directly in front of it. My workaround for this has been changing (lister-refresh-at lister-local-ewoc :point) with

(let ((ewoc lister-local-ewoc))
            (if (lister-with-sublist-below ewoc :point beg end
                  (lister--outline-invisible-p ewoc beg))
                (progn
                  (lister-mode-cycle-sublist ewoc :point)
                  (lister-refresh-at ewoc :point)
                  (lister-mode-cycle-sublist ewoc :point))
              (lister-refresh-at ewoc :point)))

But I don't think this is a nice solution.

publicimageltd commented 2 years ago

Thanks for reporting! I'm on vacation right now, but will look at it ASAP when I return. There is something inherently buggy in all that invisible stuff, so maybe that's a good test case for finding the problem...

publicimageltd commented 2 years ago

I think I identified the problem. Please update lister, the latest change there should fix the issue. Give me some feedback and close the issue if it is OK.

The fix works, but introduces some inconsistent behavior: sometimes the ellipsis is shown on a separate line instead at the end, as I think should be the normal case. Can't fix this quite now, but I hope the current solution works well enough.

The new issue comes up if you preview a node with empty preview text, that is, if there are just spaces or newlines. Actually these kind of 'whitespace-only' previews should not be allowed anyways, so that's another upcoming fix.

cheerio-pixel commented 2 years ago

Thanks, the I don't see any more problems.