From bcad75fbe8c8b399432ab3c3c6e95be6e7d471c5 Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Wed, 16 Sep 2009 12:24:36 +0200 Subject: [PATCH] auto complete quote and singlequotes --- src/plugins/texteditor/basetexteditor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 4a446fd2543..0ad359d5170 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -1060,6 +1060,8 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e) QTextCursor cursor = textCursor(); QString text = e->text(); QString autoText; + + // TODO disable this inside string or character literals if (d->m_autoParenthesesEnabled && d->m_document->tabSettings().m_autoParentheses) { foreach(QChar c, text) { QChar close; @@ -1069,6 +1071,10 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e) close = QLatin1Char(')'); else if (c == QLatin1Char('[')) close = QLatin1Char(']'); + else if (c == QLatin1Char('\"')) + close = c; + else if (c == QLatin1Char('\'')) + close = c; if (!close.isNull()) autoText += close; } -- GitLab