diff --git a/src/plugins/duieditor/duieditor.cpp b/src/plugins/duieditor/duieditor.cpp
index b3e701775943e8c9b47f207d97b5616a2e2d6dc5..d259adfed1bb5a71b7e57c7f32cdf5dadb4b6dc6 100644
--- a/src/plugins/duieditor/duieditor.cpp
+++ b/src/plugins/duieditor/duieditor.cpp
@@ -622,6 +622,10 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha
 		|| ((typedChar == QChar::Null) && block.text().trimmed() == "}")) {
 
 		QTextCursor tc(block);
+
+		if (typedChar == QLatin1Char('}')
+			tc = textCursor();
+		
 		if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) {
 			const QString text = tc.block().text();
 			int indent = ts.columnAt(text, ts.firstNonSpace(text));