Only insert line break for block formats if the block already has text (#1349, #1350)

This commit is contained in:
Veronica Berglyd Olsen
2023-02-10 20:01:46 +01:00
parent 25ab8ccbce
commit 5b20061607
+2 -1
View File
@@ -1750,6 +1750,7 @@ class GuiDocEditor(QTextEdit):
# Remove existing format first, if any
theText = theBlock.text()
hasText = len(theText) > 0
if theText.startswith("@"):
logger.error("Cannot apply block format to keyword/value line")
return False
@@ -1855,7 +1856,7 @@ class GuiDocEditor(QTextEdit):
posS = theCursor.selectionStart()
theCursor.removeSelectedText()
theCursor.setPosition(posS)
if posS > 0:
if posS > 0 and hasText:
theCursor.insertBlock()
theCursor.insertText(theText)
if posO - cOffset >= 0: