DeepL: trim after expand

pull/199/head
M66B 3 years ago
parent 40bd69398a
commit 99f6e716a5

@ -1999,10 +1999,17 @@ public class FragmentCompose extends FragmentBase {
end = tmp;
}
// Create paragraph
// Expand selection at start
while (start > 0 && edit.charAt(start - 1) != '\n')
start--;
if (start == end && end < edit.length())
end++;
// Expand selection at end
while (end > 0 && end < edit.length() && edit.charAt(end - 1) != '\n')
end++;
// Trim start
while (start < edit.length() - 1 && edit.charAt(start) == '\n')
start++;
@ -2011,14 +2018,6 @@ public class FragmentCompose extends FragmentBase {
while (end > 1 && edit.charAt(end - 2) == '\n')
end--;
// Expand selection at start
while (start > 0 && edit.charAt(start - 1) != '\n')
start--;
// Expand selection at end
while (end > 0 && end < edit.length() && edit.charAt(end - 1) != '\n')
end++;
if (start < end)
return new Pair(start, end);

Loading…
Cancel
Save