diff --git a/.gitattributes b/.gitattributes index 67bc519..ad19ed1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ /libs/cjson/** linguist-vendored /libs/unicode_width/** linguist-vendored +*.scm linguist-language=tree-sitter-query diff --git a/src/ts.cc b/src/ts.cc index 9ef6f38..da9c22a 100644 --- a/src/ts.cc +++ b/src/ts.cc @@ -185,14 +185,14 @@ void ts_collect_spans(Editor *editor) { return; std::vector edits; TSInputEdit edit; - if (copy) { + if (copy) while (editor->edit_queue.pop(edit)) { edits.push_back(edit); ts_tree_edit(copy, &edits.back()); } - } tree = ts_parser_parse(editor->parser, copy, tsinput); - ts_tree_delete(copy); + if (copy) + ts_tree_delete(copy); while (editor->edit_queue.pop(edit)) { edits.push_back(edit); ts_tree_edit(tree, &edits.back());