DM-307: Fixed applyWithLineBreaks
This commit is contained in:
parent
a1ebcc2abf
commit
210186bfd7
@ -7,7 +7,6 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -210,14 +209,16 @@ public class AtomicTextBlock implements TextBlock {
|
||||
return "";
|
||||
}
|
||||
|
||||
CharSequence subSequence = subSequence(boundary);
|
||||
Set<Integer> lbInBoundary = new HashSet<>(lineBreaks);
|
||||
Set<Integer> lbInBoundary = lineBreaks.stream()
|
||||
.map(i -> i+ boundary.start())
|
||||
.filter(boundary::contains)
|
||||
.collect(Collectors.toSet());
|
||||
if (boundary.end() == getBoundary().end()) {
|
||||
lbInBoundary.add(getBoundary().length());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < subSequence.length(); i++) {
|
||||
char character = subSequence.charAt(i);
|
||||
for (int i = boundary.start(); i < boundary.end(); i++) {
|
||||
char character = this.charAt(i);
|
||||
if (lbInBoundary.contains(i + 1)) {
|
||||
// always plus one, due to the linebreaks being an exclusive end index
|
||||
if (!Character.isWhitespace(character)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user