--- a/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py Wed Oct 19 13:39:16 2022 +0200 +++ b/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py Wed Oct 19 17:00:05 2022 +0200 @@ -214,15 +214,13 @@ docstringList[0] = self.__quote3 + docstringList[0] newCursorLine = insertLine docstringList.append(self.__quote3) - return ( - ( - indentation - + "{0}{1}".format(sep, indentation).join(docstringList) - + sep - ), - (insertLine, 0), - newCursorLine, - ) + for index, line in enumerate(docstringList): + docstringList[index] = ( + indentation + line + if bool(line.strip()) + else "" + ) + return sep.join(docstringList) + sep, (insertLine, 0), newCursorLine return "", (0, 0), 0 @@ -290,7 +288,7 @@ def __generateDocstringFromBelow(self, cursorPosition): """ - Private method to generate a docstring when the gicen position is on + Private method to generate a docstring when the given position is on the line below the end of the definition. @param cursorPosition position of the cursor (line and index) @@ -324,7 +322,13 @@ docstringList[0] = self.__quote3 + docstringList[0] newCursorLine = cursorPosition[0] docstringList.append(self.__quote3) - docstring = "{0}{1}".format(sep, indentation).join(docstringList) + for index, line in enumerate(docstringList): + docstringList[index] = ( + indentation + line + if bool(line.strip()) + else "" + ) + docstring = sep.join(docstringList) + indentation return docstring, cursorPosition, newCursorLine return "", (0, 0), 0