Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ public Paragraph<PS, SEG, S> subSequence(int start) {
throw new IllegalArgumentException("start must not be negative (was: " + start + ")");
} else if(start == 0) {
return this;
} else if(start <= length()) {
} else if (start == length()) {
// in case one is using EitherOps<SegmentOps, SegmentOps>, force the empty segment
// to use the left ops' default empty seg, not the right one's empty seg
return new Paragraph<>(paragraphStyle, segmentOps, segmentOps.createEmpty());
} else if(start < length()) {
Position pos = navigator.offsetToPosition(start, Forward);
int segIdx = pos.getMajor();
List<SEG> segs = new ArrayList<>(segments.size() - segIdx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ public String toString() {
public boolean equals(Object obj) {
if(obj instanceof StyledText) {
StyledText<?> that = (StyledText<?>) obj;
return Objects.equals(this.text, that.text)
&& Objects.equals(this.style, that.style);
return (this.text.isEmpty() && that.text.isEmpty())
|| (Objects.equals(this.text, that.text)
&& Objects.equals(this.style, that.style));
} else {
return false;
}
Expand Down