Make TextUtilities::CutPart more strict.
This commit is contained in:
parent
b05f7eb915
commit
383b5b8f7e
1 changed files with 6 additions and 5 deletions
|
|
@ -1424,7 +1424,11 @@ QStringList PrepareSearchWords(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CutPart(TextWithEntities &sending, TextWithEntities &left, int32 limit) {
|
bool CutPart(TextWithEntities &sending, TextWithEntities &left, int32 limit) {
|
||||||
if (left.text.isEmpty() || !limit) return false;
|
Expects(limit > 0);
|
||||||
|
|
||||||
|
if (left.text.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32 currentEntity = 0, goodEntity = currentEntity, entityCount = left.entities.size();
|
int32 currentEntity = 0, goodEntity = currentEntity, entityCount = left.entities.size();
|
||||||
bool goodInEntity = false, goodCanBreakEntity = false;
|
bool goodInEntity = false, goodCanBreakEntity = false;
|
||||||
|
|
@ -1533,10 +1537,7 @@ bool CutPart(TextWithEntities &sending, TextWithEntities &left, int32 limit) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sending.text = left.text;
|
sending = base::take(left);
|
||||||
left.text = QString();
|
|
||||||
sending.entities = left.entities;
|
|
||||||
left.entities = EntitiesInText();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue