Skip to content

Commit

Permalink
Fix multi paragraph insert creation (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen authored Aug 25, 2020
1 parent 2b8af0b commit 1a3bda9
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> fromString(String
* @param <S> The type of the style of individual segments.
*/
public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> fromSegment(SEG segment, PS paragraphStyle, S style, SegmentOps<SEG, S> segmentOps) {
if ( segment instanceof String && segmentOps instanceof TextOps ) {
return fromString( (String) segment, paragraphStyle, style, (TextOps<SEG,S>) segmentOps );
}
Paragraph<PS, SEG, S> content = new Paragraph<PS, SEG, S>(paragraphStyle, segmentOps, segment, style);
List<Paragraph<PS, SEG, S>> res = Collections.singletonList(content);
return new ReadOnlyStyledDocument<>(res);
Expand Down

0 comments on commit 1a3bda9

Please sign in to comment.