PageAdapter: fix empty lines issues in pre blocks

This commit is contained in:
dece 2022-01-28 12:07:38 +01:00
parent 117c70100f
commit 30d7ce72b8

View file

@ -73,9 +73,11 @@ class PageAdapter(private val listener: ContentAdapterListener) :
} }
is PreTextLine -> { is PreTextLine -> {
val lastBlock = blocks.last() val lastBlock = blocks.last()
if (lastBlock is ContentBlock.Pre && !lastBlock.closed) if (lastBlock is ContentBlock.Pre && !lastBlock.closed) {
lastBlock.content += line.text + "\n" if (lastBlock.content.isNotEmpty())
else lastBlock.content += "\n"
lastBlock.content += line.text
} else {
Log.e(TAG, "setLines: unexpected preformatted line") Log.e(TAG, "setLines: unexpected preformatted line")
} }
} }