File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
aztec/src/main/kotlin/org/wordpress/aztec/spans Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,18 @@ open class ParagraphSpan(
4545 val spanned = text as Spanned
4646 val spanStart = spanned.getSpanStart(this )
4747 val spanEnd = spanned.getSpanEnd(this )
48- val isFirstLine = start <= spanStart
49- val isLastLine = spanEnd <= end
48+ val previousLineBreak = if (start > 1 ) {
49+ text.substring(start- 1 , start) == " \n "
50+ } else {
51+ false
52+ }
53+ val followingLineBreak = if (end < text.length) {
54+ text.substring(end, end + 1 ) == " \n "
55+ } else {
56+ false
57+ }
58+ val isFirstLine = start <= spanStart || previousLineBreak
59+ val isLastLine = spanEnd <= end || followingLineBreak
5060 if (isFirstLine) {
5161 removeTopPadding = true
5262 fm.ascent - = paragraphStyle.verticalMargin
You can’t perform that action at this time.
0 commit comments