> >> >>> And, for tree-sitter to take the buffer’s content directly, we need to tell it to skip the gap. >> >> AFAIR, tree-sitter allows the calling package to provide a function to >> access the text, isn't that so? If so, you could write a function >> that accesses buffer text via BYTE_POS_ADDR etc., and that knows how >> to skip the gap already. > > Yes, that function returns a char*. But what if the gap is in the middle of the portion that tree-sitter wants to read? Alternatively, we can copy the text out and pass it to tree-sitter, but you don’t like that, IIRC. Or we can only copy out when the portion tree-sitter wants encompasses the gap, I expect this case to be relatively rare so we won’t copy out all the time, and most of the time tree-sitter just reads from the buffer directly. Yuan