diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 27ecdb3206a5d243b4d09251fb2e4a0bd471a531..066031801814a2947db8eda91b594912c203c3e4 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -3272,12 +3272,18 @@ void BaseTextEditor::handleBackspaceKey()
         if ((lookBehind == QLatin1Char('(') && lookAhead == QLatin1Char(')'))
             || (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']'))
             || (lookBehind == QLatin1Char('"') && lookAhead == QLatin1Char('"')
-                && lookFurtherBehind!= QLatin1Char('\\'))) {
-            cursor.beginEditBlock();
-            cursor.deleteChar();
-            cursor.deletePreviousChar();
-            cursor.endEditBlock();
-            return;
+                && lookFurtherBehind != QLatin1Char('\\'))
+            || (lookBehind == QLatin1Char('\'') && lookAhead == QLatin1Char('\'')
+                && lookFurtherBehind != QLatin1Char('\\'))) {
+            QTextCursor c = cursor;
+            c.setPosition(pos - 1);
+            if (contextAllowsAutoParentheses(c)) {
+                cursor.beginEditBlock();
+                cursor.deleteChar();
+                cursor.deletePreviousChar();
+                cursor.endEditBlock();
+                return;
+            }
         }
     }