From 4a0b2039c0ed5c1f34efaf8f53dcf04ad9f384df Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 9 Mar 2016 15:16:50 +0100 Subject: [PATCH] TextEditor: Do not delete both quotes on backspace ...if cursor is in-between. Hitting backspace when the cursor is between two quotes "|" deleted both quotes, which is unfavorable, especially when the user tries to add quotes by starting with the closing quote. Task-number: QTCREATORBUG-14111 Change-Id: I8f08f355e34fba1b517dad9864944cb11ff5c1c2 Reviewed-by: Eike Ziller Reviewed-by: David Schulz --- src/plugins/texteditor/autocompleter.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/plugins/texteditor/autocompleter.cpp b/src/plugins/texteditor/autocompleter.cpp index d2de0effc87..8cf39ac6ec7 100644 --- a/src/plugins/texteditor/autocompleter.cpp +++ b/src/plugins/texteditor/autocompleter.cpp @@ -208,7 +208,6 @@ bool AutoCompleter::autoBackspace(QTextCursor &cursor) QTextDocument *doc = cursor.document(); const QChar lookAhead = doc->characterAt(pos); const QChar lookBehind = doc->characterAt(pos - 1); - const QChar lookFurtherBehind = doc->characterAt(pos - 2); const QChar character = lookBehind; if (character == QLatin1Char('(') || character == QLatin1Char('[')) { @@ -237,11 +236,7 @@ bool AutoCompleter::autoBackspace(QTextCursor &cursor) // ### this code needs to be generalized if ((lookBehind == QLatin1Char('(') && lookAhead == QLatin1Char(')')) - || (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']')) - || (lookBehind == QLatin1Char('"') && lookAhead == QLatin1Char('"') - && lookFurtherBehind != QLatin1Char('\\')) - || (lookBehind == QLatin1Char('\'') && lookAhead == QLatin1Char('\'') - && lookFurtherBehind != QLatin1Char('\\'))) { + || (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']'))) { if (! isInComment(c)) { cursor.beginEditBlock(); cursor.deleteChar();