1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Revert "Read more on each call to treesit's buffer reader"

This reverts commit bf23382f1f.

We move around the gap, narrow regions, ralloc, etc, and don't have a
way to invalidate previously given range.  So tree-sitter can't be given
the full range.
This commit is contained in:
Yuan Fu 2024-09-13 22:53:06 -07:00
parent c70bd0e3fe
commit 76faf7e609
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -1228,13 +1228,11 @@ treesit_read_buffer (void *parser, uint32_t byte_index,
beg = NULL;
len = 0;
}
/* Normal case, read until the gap or visible end. */
/* Normal case, read a character. */
else
{
beg = (char *) BUF_BYTE_ADDRESS (buffer, byte_pos);
ptrdiff_t gap_bytepos = BUF_GPT_BYTE (buffer);
len = (byte_pos < gap_bytepos)
? gap_bytepos - byte_pos : visible_end - byte_pos;
len = BYTES_BY_CHAR_HEAD ((int) *beg);
}
/* We never let tree-sitter to parse buffers that large so this
assertion should never hit. */