diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index cd406907e038af12d4c1156206f87ba44192abaa..2e1de346320eebd7346ef69acb58adc09e9f8b2b 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4654,6 +4654,7 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) } cursor.beginEditBlock(); + cursor.removeSelectedText(); bool insertAtBeginningOfLine = ts.cursorIsAtBeginningOfLine(cursor); @@ -4664,8 +4665,6 @@ void BaseTextEditor::insertFromMimeData(const QMimeData *source) return; } - cursor.removeSelectedText(); - int reindentBlockStart = cursor.blockNumber() + (insertAtBeginningOfLine?0:1); bool hasFinalNewline = (text.endsWith(QLatin1Char('\n'))