Inform callbacks about updated scopes when interrupting “batch parsing”

We delay updating callbacks until we have parsed 10 lines to avoid line-by-line redraw of the screen, but incase the buffer got mutated during this batch parsing, we would previously restart the parser and forget about the ranges already parsed (that no-one had been told about).
This commit is contained in:
Allan Odgaard
2016-08-28 17:03:26 +02:00
parent 7029992159
commit 9c4589d541

View File

@@ -58,8 +58,16 @@ namespace ng
if(bufferRef.lock())
{
if(bufferRev == revision())
update_scopes(limit_redraw, batch_start, { from, to }, result.scopes, result.state);
else initiate_repair();
{
update_scopes(limit_redraw, batch_start, { from, to }, result.scopes, result.state);
}
else
{
// We didnt inform anyone about the previous lines parsed
if(batch_start != from)
did_parse(std::min(batch_start, size()), std::min(from, size()));
initiate_repair();
}
}
});
CFRunLoopWakeUp(runLoop);