arthurbacci / Teditor

A simple text/code editor
GNU General Public License v3.0
74 stars 7 forks source link

Optimize syntaxHighlight for default_syntax and remove unnecessary calls #49

Closed bynect closed 3 years ago

bynect commented 3 years ago

Create a special optimization for default_syntax in syntaxHighlight (note that this is only valid as long as default_syntax is empty) that just zeroes all visible lines without checking for string/comment/etc. Also remove some unnecessary/redundant calls to syntaxHighlight (even the one in the main loop) by trying to cover all possible cases in which syntaxHighlight should be called, but not when it should have not effect, like when a blank line is added.

bynect commented 3 years ago

Don't merge yet, I just encountered a segfault when testing on empty files

bynect commented 3 years ago

Seems to be fixed now, just tested on empty and really long files with and without syntax