Always invalidate old chunk of text when parsing after an edit

This commit is contained in:
Max Brunsfeld 2017-10-04 15:09:46 -07:00
parent c0073c5b72
commit 36c2b685b9
5 changed files with 38 additions and 6 deletions

View file

@ -9,9 +9,9 @@ using std::string;
using std::vector;
SpyInput::SpyInput(string content, size_t chars_per_chunk) :
chars_per_chunk(chars_per_chunk),
buffer(nullptr),
byte_offset(0),
chars_per_chunk(chars_per_chunk),
content(content),
encoding(TSInputEncodingUTF8),
ranges_read({}) {}

View file

@ -12,7 +12,6 @@ struct SpyInputEdit {
};
class SpyInput {
uint32_t chars_per_chunk;
char *buffer;
uint32_t byte_offset;
std::vector<SpyInputEdit> undo_stack;
@ -31,6 +30,7 @@ class SpyInput {
TSInputEdit undo();
std::vector<std::string> strings_read() const;
uint32_t chars_per_chunk;
std::string content;
TSInputEncoding encoding;
std::vector<std::pair<uint32_t, uint32_t>> ranges_read;