diff --git a/src/plugins/python/pythonindenter.cpp b/src/plugins/python/pythonindenter.cpp index b907d0f4531..b9d2bbbd9c7 100644 --- a/src/plugins/python/pythonindenter.cpp +++ b/src/plugins/python/pythonindenter.cpp @@ -64,6 +64,10 @@ int PythonIndenter::indentFor(const QTextBlock &block, if (!previousBlock.isValid()) return 0; + // OPENMV-DIFF // + int previousIndentation = tabSettings.indentationColumn(previousBlock.text()); + // OPENMV-DIFF // + // When pasting in actual code, try to skip back past empty lines to an // actual code line to find a suitable indentation. This prevents code from // not being indented when pasting below an empty line. @@ -81,6 +85,11 @@ int PythonIndenter::indentFor(const QTextBlock &block, else indentation = qMax(0, indentation + getIndentDiff(previousLine, tabSettings)); + // OPENMV-DIFF // + if (previousIndentation < indentation) + indentation = previousIndentation; + // OPENMV-DIFF // + return indentation; }