Merge pull request #33046 from zatherz/master

Don't terminate search if begin_key doesn't fit (Fixes #33034)
This commit is contained in:
Rémi Verschelde 2019-10-25 08:37:41 +02:00 committed by GitHub
commit 2869c13ba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,58 +161,59 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
/* BEGIN */
int lr = cr.begin_key.length();
if (lr == 0 || lr > left)
continue;
const CharType *kc;
bool match;
const CharType *kc = cr.begin_key.c_str();
if (lr != 0 && lr <= left) {
kc = cr.begin_key.c_str();
bool match = true;
match = true;
for (int k = 0; k < lr; k++) {
if (kc[k] != str[i + k]) {
match = false;
break;
}
}
if (match) {
ColorRegionInfo cri;
cri.end = false;
cri.region = j;
text.write[p_line].region_info[i] = cri;
i += lr - 1;
for (int k = 0; k < lr; k++) {
if (kc[k] != str[i + k]) {
match = false;
break;
}
}
if (match) {
ColorRegionInfo cri;
cri.end = false;
cri.region = j;
text.write[p_line].region_info[i] = cri;
i += lr - 1;
break;
}
/* END */
lr = cr.end_key.length();
if (lr == 0 || lr > left)
continue;
if (lr != 0 && lr <= left) {
kc = cr.end_key.c_str();
kc = cr.end_key.c_str();
match = true;
match = true;
for (int k = 0; k < lr; k++) {
if (kc[k] != str[i + k]) {
match = false;
break;
}
}
if (match) {
ColorRegionInfo cri;
cri.end = true;
cri.region = j;
text.write[p_line].region_info[i] = cri;
i += lr - 1;
for (int k = 0; k < lr; k++) {
if (kc[k] != str[i + k]) {
match = false;
break;
}
}
if (match) {
ColorRegionInfo cri;
cri.end = true;
cri.region = j;
text.write[p_line].region_info[i] = cri;
i += lr - 1;
break;
}
}
}
}