zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.39k stars 1.16k forks source link

highlighter: Fix last open racy access in the `*Highlight*()` functions #3242

Open JoeKar opened 2 months ago

JoeKar commented 2 months ago

Otherwise it's possible that *Highlight*() functions called from the async initial highlighting can be interrupted by the main goroutine, which then changes the already set and furthermore used h.lastRegion. The resulting last region respective set state isn't reliable any longer then.

The need for this came up in #3237.