Check context when removing matching parentheses

Done with mae.
This commit is contained in:
Thorbjørn Lindeijer
2009-09-16 16:28:32 +02:00
parent 66f2e3235e
commit 9ff527e2aa

View File

@@ -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;
}
}
}