diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2017-07-17 12:57:23 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2017-07-21 11:42:46 +0000 |
commit | a6aa287720112c70c1363bcb46d55d438fe57eac (patch) | |
tree | ebcc2c8005a92977fed1c391d07ac296a7cc2b34 /src/plugins/texteditor/autocompleter.h | |
parent | 2c9feb1f4b301e9a9228739a89c438bb7ff043f0 (diff) |
C++: Fine-tune auto insertion of '}'
Do not insert for these cases:
* <Cursor>{
* namespace X <Cursor>
* if the next block is indented, like e.g.:
if (e) <Cursor>
g();
* on empty line if text before looks like a finished statement or
scope opening/end
Change-Id: Id9decc1e964a775724a929c2a3e79b5283105560
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/autocompleter.h')
-rw-r--r-- | src/plugins/texteditor/autocompleter.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/texteditor/autocompleter.h b/src/plugins/texteditor/autocompleter.h index 5d12b63b83..4847f50476 100644 --- a/src/plugins/texteditor/autocompleter.h +++ b/src/plugins/texteditor/autocompleter.h @@ -31,6 +31,7 @@ #include <QString> QT_BEGIN_NAMESPACE +class QTextBlock; class QTextCursor; QT_END_NAMESPACE @@ -90,6 +91,7 @@ public: virtual QString insertParagraphSeparator(const QTextCursor &cursor) const; static bool isQuote(const QString &text); + bool isNextBlockIndented(const QTextBlock ¤tBlock) const; private: QString replaceSelection(QTextCursor &cursor, const QString &textToInsert) const; |