inokawa / rich-textarea

A small customizable textarea for React to colorize, highlight, decorate texts, offer autocomplete and much more.

Home Page:https://inokawa.github.io/rich-textarea/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix bugs when multiple regex conflicted when using createRegexRenderer

inokawa opened this issue · comments

I also have this issue. As soon as multiple expressions match, the content in that match appears more than once. For instance, if you have an expression to provide syntax highlighting to brackets, that works fine. If you add another expression to highlight brackets with a specific keyword inside of them, the content appears twice. Add another, it appears three times, and so on.

I understand restrictions for render functions but just for styles, I’d expect the result to just be a composite of all matches. Maybe the easiest approach would be to have two renderer types instead of one using the StyleOrRender union type — then, we might have one easy to use StyleRenderer extends Renderer and another ElementTransformRenderer extends Renderer if needed.

Alternatively, the matches may have to be applied onto the last created result in order to not just add more and more matches for each overlapping expression.

I have the same problem

Probably fixed in 0.20.0.