Merge pull request #1602 from the-mikedavis/md-ignore-future-matches-for-non-local-patterns

prevent future captures for `#is-not? local` matches
This commit is contained in:
Max Brunsfeld 2022-01-19 16:40:30 -08:00 committed by GitHub
commit fce23d63b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 0 deletions

View file

@ -3727,6 +3727,20 @@ void ts_query_cursor_remove_match(
return;
}
}
// Remove unfinished query states as well to prevent future
// captures for a match being removed.
for (unsigned i = 0; i < self->states.size; i++) {
const QueryState *state = &self->states.contents[i];
if (state->id == match_id) {
capture_list_pool_release(
&self->capture_list_pool,
state->capture_list_id
);
array_erase(&self->states, i);
return;
}
}
}
bool ts_query_cursor_next_capture(