Karthik Chikmagalur <karthikchikmaga...@gmail.com> writes: > Here is an example. An environment is being previewed live, and edited: > > https://share.karthinks.com/olp-live-preview-deletion-bug.mp4 > > When you delete the \begin{FOO} line and move the cursor away, the live > preview disappears as it should, because the Org element is no longer a > LaTeX environment. But when you delete the \end{FOO} line, the preview > doesn't clear because the start of the element, at \begin{FOO}, is still > a LaTeX fragment. Fixing this is subtle.
I see what the problem is. You will get a similar problem if you insert, say, a heading in the middle of latex environment by typing "* foo" AFAIU, the preview overlay should contain some information about the latex environment boundaries that it is previewing. If those boundaries suddenly contain multiple Org elements it is probably the time to remove that overlay. I believe that such approach should solve your scenario. WDYT? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>