aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2016-06-10 15:13:38 +0200
committerDavid Schulz <david.schulz@theqtcompany.com>2016-06-21 11:56:56 +0000
commit675060724453fc2a5d12431b656fdbb599e529f6 (patch)
treecbf5a1fc06919089d4028bd31c6ae7e15ee575b6 /src/plugins/glsleditor
parent08dcad9c829abfbc592d6a4628d091d942a87c0f (diff)
Editor: Skip auto completed character only if it was recently inserted.
This means you can skip automatically inserted characters as long as you don't explicitly move the text cursor and the editor doesn't lose the focus. This will be visualized by highlighting the automatically inserted character as long as you can perform the skipping. This will reduce unexpected skipping in the case a cursor was explicitly placed before an closing brace and a closing brace is typed. Change-Id: I28e29e79ba10c9c48e8bc8817405fea630cca9bd Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glslautocompleter.cpp10
-rw-r--r--src/plugins/glsleditor/glslautocompleter.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/glsleditor/glslautocompleter.cpp b/src/plugins/glsleditor/glslautocompleter.cpp
index e0ff3df2e8..cf19c7310e 100644
--- a/src/plugins/glsleditor/glslautocompleter.cpp
+++ b/src/plugins/glsleditor/glslautocompleter.cpp
@@ -55,15 +55,17 @@ bool GlslCompleter::isInComment(const QTextCursor &cursor) const
}
QString GlslCompleter::insertMatchingBrace(const QTextCursor &cursor, const QString &text,
- QChar lookAhead, int *skippedChars) const
+ QChar lookAhead, bool skipChars, int *skippedChars) const
{
- return CPlusPlus::MatchingText::insertMatchingBrace(cursor, text, lookAhead, skippedChars);
+ return CPlusPlus::MatchingText::insertMatchingBrace(cursor, text, lookAhead,
+ skipChars, skippedChars);
}
QString GlslCompleter::insertMatchingQuote(const QTextCursor &cursor, const QString &text,
- QChar lookAhead, int *skippedChars) const
+ QChar lookAhead, bool skipChars, int *skippedChars) const
{
- return CPlusPlus::MatchingText::insertMatchingQuote(cursor, text, lookAhead, skippedChars);
+ return CPlusPlus::MatchingText::insertMatchingQuote(cursor, text, lookAhead,
+ skipChars, skippedChars);
}
QString GlslCompleter::insertParagraphSeparator(const QTextCursor &cursor) const
diff --git a/src/plugins/glsleditor/glslautocompleter.h b/src/plugins/glsleditor/glslautocompleter.h
index 59cfd3daed..9e193132e8 100644
--- a/src/plugins/glsleditor/glslautocompleter.h
+++ b/src/plugins/glsleditor/glslautocompleter.h
@@ -40,9 +40,9 @@ public:
bool contextAllowsElectricCharacters(const QTextCursor &cursor) const override;
bool isInComment(const QTextCursor &cursor) const override;
QString insertMatchingBrace(const QTextCursor &cursor, const QString &text,
- QChar lookAhead, int *skippedChars) const override;
+ QChar lookAhead, bool skipChars, int *skippedChars) const override;
QString insertMatchingQuote(const QTextCursor &cursor, const QString &text,
- QChar lookAhead, int *skippedChars) const override;
+ QChar lookAhead, bool skipChars, int *skippedChars) const override;
QString insertParagraphSeparator(const QTextCursor &cursor) const override;
};