diff --git a/plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/editor/pythoneditor.py b/plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/editor/pythoneditor.py --- a/plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/editor/pythoneditor.py +++ b/plugins/extensions/pykrita/plugin/plugins/scripter/ui_scripter/editor/pythoneditor.py @@ -239,7 +239,11 @@ selectionStart = cursor.selectionStart() selectionEnd = cursor.selectionEnd() - if selectionStart == selectionEnd: # ie no selection + + if selectionStart == selectionEnd and cursor.atBlockEnd(): + # ie no selection and don't insert in the middle of text + # something smarter might skip whitespace and add a tab in front of + # the next non whitespace character cursor.insertText(" "*self.indent_width) return