Add public API to set the input string with explicit length.

This commit is contained in:
Rob Rix 2017-02-10 09:10:31 -05:00
parent e6927238e1
commit c230658bae
2 changed files with 10 additions and 0 deletions

View file

@ -77,6 +77,15 @@ void ts_document_set_input_string(TSDocument *self, const char *text) {
}
}
void ts_document_set_input_string_with_length(TSDocument *self, const char *text, uint32_t length) {
ts_document_invalidate(self);
TSInput input = ts_string_input_make_with_length(text, length);
ts_document_set_input(self, input);
if (input.payload) {
self->owns_input = true;
}
}
void ts_document_edit(TSDocument *self, TSInputEdit edit) {
if (!self->tree)
return;