forked from qt-creator/qt-creator
Revert "TextEditor: Do not delete both quotes on backspace"
We have a more intelligent placing of double quotes, that should
eliminate some of the incorrect/unwanted placed closing quotes.
Additionally we introduced an animation and highlight of automatically
inserted text. So it should be definitely clear that the closing quote
is going to be removed.
If there is still someone who gets annoyed by this reintroduced behavior
there is now a setting that lets you control the deletion of
automatically inserted text.
So it is safe to reintroduce the deletion of closing quotes on
backspace.
This reverts commit 4a0b2039c0
.
Change-Id: I92500ac218dc4c2e07a3b0ad01b06e6baa2e2c6c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
David Schulz
parent
eba6da37c6
commit
c8ef91f789
@@ -212,6 +212,7 @@ 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('[')) {
|
||||
@@ -240,7 +241,11 @@ bool AutoCompleter::autoBackspace(QTextCursor &cursor)
|
||||
|
||||
// ### this code needs to be generalized
|
||||
if ((lookBehind == QLatin1Char('(') && lookAhead == QLatin1Char(')'))
|
||||
|| (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']'))) {
|
||||
|| (lookBehind == QLatin1Char('[') && lookAhead == QLatin1Char(']'))
|
||||
|| (lookBehind == QLatin1Char('"') && lookAhead == QLatin1Char('"')
|
||||
&& lookFurtherBehind != QLatin1Char('\\'))
|
||||
|| (lookBehind == QLatin1Char('\'') && lookAhead == QLatin1Char('\'')
|
||||
&& lookFurtherBehind != QLatin1Char('\\'))) {
|
||||
if (! isInComment(c)) {
|
||||
cursor.beginEditBlock();
|
||||
cursor.deleteChar();
|
||||
|
Reference in New Issue
Block a user