metaeducation / ren-c

Library for embedding a Rebol interpreter into C codebases
GNU Lesser General Public License v3.0
126 stars 27 forks source link

eparse does not remove marks on subsequent parses of the same editor window #1143

Closed IngoHohmann closed 2 years ago

IngoHohmann commented 2 years ago

If you run eparse with changed editor text, or changed rules, the underlines from the previous run are not removed.

hostilefork commented 2 years ago

(Sidenote: Please open Replpad-specific PRs in the hostilefork/replpad-js repo)


I had a bug where I was filtering based on cm_underline instead of cm-underline. So here:

https://github.com/hostilefork/replpad-js/blob/8fd981d8c8ca6a9a8cd6fbbfa1e3460e7e1f9ac9/underline-extension.js#L96

That meant value.class !== "cm_underline" was always true. True in the filter means the marker is kept.

Additionally, negative logic is always confusing. And if you branch it out, it gives opportunities for commenting:

if value.class == "cm-underline"
    return false  // filter out any marks with underline class
return true  // leave any other marks (no others in this field...yet!)

If you suffer through trying to understand something, and find anything that could use improvements of that nature, feel free to PR the improvements--however minor. I'm kind of doing big picture stuff and that takes a lot of energy, so my explanations aren't as good as usual.