Open DivineDominion opened 7 years ago
Another approach: Marklight.processEditing
does not take the whole textStorage.string for scanning, but a substring of potentially affected paragraphs. I don't think that'll help a lot since the regex matching uses a sub-range
already.
While refactoring, another idea came to mind. There's block styles, and there's inline/span styles. Just like TextMate, we could match the blocks first, and then inside the blocks apply inline styles as needed. For example: apply no inline styles inside code blocks.
Might also save a few cycles to process the current line + surrounding lines as blocks, not the whole document, and then kick of inline styling from there.
Edge case to take note of: opening a code block with ``` should result in the whole rest of the document to be part of the code. So in this case, and probably others, we need to more greedily style the whole document.
I notices that no matter what you type, the energy consumption gets pretty high quickly and stays high. I bet that's because of the quadrillion regular expressions that are executed.
Then I had the following idea, from easy to accurate:
\
*_[]()#`), text has been pasted, or something has been deletedAny additional ideas?