[reader] Improved previous position algorithm and fixed symbols

This commit is contained in:
Laury
2022-05-01 21:02:07 +02:00
parent 745099842a
commit adab2c223b
6 changed files with 35 additions and 12 deletions

View File

@@ -109,7 +109,7 @@ int filesWithExtension(const char* extension, External::Archive::File* files, in
#endif
const char * EndOfPrintableWord(const char * word, const char * end) {
if (word == end) {
if (word >= end) {
return word;
}
UTF8Decoder decoder(word);
@@ -126,11 +126,11 @@ const char * EndOfPrintableWord(const char * word, const char * end) {
}
const char * StartOfPrintableWord(const char * word, const char * start) {
if (word == start) {
if (word <= start) {
return word;
}
// Go to start of code point with some code points dark magic
if (!(*word & 0x80 == 0)) {
if (!((*word & 0x80) == 0)) {
word--;
while (!(*word & 0x80 && *word & 0x40)) {
word--;