mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Handle searching files that end with an incomplete UTF-8 sequence
Previously this would cause infinite looping as we tried to read more to complete the UTF-8 sequence.
This commit is contained in:
@@ -115,6 +115,9 @@ namespace file
|
||||
ssize_t len = read(_fd, &buf.front(), buf.size());
|
||||
buf.resize(len < 0 ? 0 : len);
|
||||
|
||||
if(len == 0 && !utf8::is_valid(_spillover.begin(), _spillover.end()))
|
||||
_spillover = "\uFFFD";
|
||||
|
||||
buf.insert(buf.begin(), _spillover.begin(), _spillover.end());
|
||||
_spillover.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user