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 -> {
val lastBlock = blocks.last()
if (lastBlock is ContentBlock.Pre && !lastBlock.closed)
lastBlock.content += line.text + "\n"
else
if (lastBlock is ContentBlock.Pre && !lastBlock.closed) {
if (lastBlock.content.isNotEmpty())
lastBlock.content += "\n"
lastBlock.content += line.text
} else {
Log.e(TAG, "setLines: unexpected preformatted line")
}
}