Skip to content

Commit

Permalink
Only insert line break for block formats if the block already has text (
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo committed Feb 10, 2023
1 parent 25ab8cc commit 5b20061
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion novelwriter/gui/doceditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ def _formatBlock(self, docAction):

# 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
Expand Down Expand Up @@ -1855,7 +1856,7 @@ def _formatBlock(self, docAction):
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:
Expand Down

0 comments on commit 5b20061

Please sign in to comment.