1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-15 08:29:24 +00:00

LanguageTool: hard limit number of paragraphs

This commit is contained in:
M66B 2022-11-15 12:21:03 +01:00
parent 7d78e88a9d
commit 9ae7bfbfd6

View file

@ -115,9 +115,7 @@ public class LanguageTool {
Matcher matcher = pattern.matcher(text);
int index = 0;
boolean links = false;
while (matcher.find()) {
links = true;
int start = matcher.start();
int end = matcher.end();
paragraphs.addAll(getParagraphs(index, start, text));
@ -131,7 +129,7 @@ public class LanguageTool {
for (Pair<Integer, Integer> paragraph : paragraphs)
Log.i("LT paragraph " + paragraph.first + "..." + paragraph.second +
" '" + text.subSequence(paragraph.first, paragraph.second).toString().replace('\n', '|') + "'");
if (links || paragraphs.size() <= LT_MAX_RANGES) {
if (paragraphs.size() <= LT_MAX_RANGES) {
List<Suggestion> result = new ArrayList<>();
for (Pair<Integer, Integer> range : paragraphs)
result.addAll(getSuggestions(context, text, range.first, range.second));