From 108b99f99b3f0c292c1394c7ac5a6c098f03143c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 21 Nov 2020 15:16:02 +0100 Subject: [PATCH] Improve the insert keyword feature when in the middle of a paragraph --- nw/gui/doceditor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 5f12b77a..d76623ce 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -773,11 +773,16 @@ class GuiDocEditor(QTextEdit): return False theCursor.beginEditBlock() + if theBlock.length() > 1: + theCursor.setPosition(theBlock.position() + theBlock.length() - 1) theCursor.insertText("\n") + theCursor.insertText("%s: " % keyWord) theCursor.endEditBlock() + self.setTextCursor(theCursor) + return True def closeSearch(self):