Remove all the synthesized characters when matching curly braces

This commit is contained in:
Roberto Raggi
2009-09-21 18:19:09 +02:00
parent 29f03c7526
commit b9ce92ec4d
3 changed files with 32 additions and 16 deletions

View File

@@ -75,7 +75,16 @@ static bool isCompleteCharLiteral(const BackwardsScanner &tk, int index)
return false;
}
static bool shouldInsertMatchingText(const QChar &lookAhead)
MatchingText::MatchingText()
{ }
bool MatchingText::shouldInsertMatchingText(const QTextCursor &tc)
{
QTextDocument *doc = tc.document();
return shouldInsertMatchingText(doc->characterAt(tc.selectionEnd()));
}
bool MatchingText::shouldInsertMatchingText(const QChar &lookAhead)
{
switch (lookAhead.unicode()) {
case '{': case '}':
@@ -91,9 +100,6 @@ static bool shouldInsertMatchingText(const QChar &lookAhead)
} // switch
}
MatchingText::MatchingText()
{ }
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
const QChar &la, int *skippedChars) const
{

View File

@@ -41,6 +41,9 @@ class CPLUSPLUS_EXPORT MatchingText
public:
MatchingText();
static bool shouldInsertMatchingText(const QTextCursor &tc);
static bool shouldInsertMatchingText(const QChar &lookAhead);
QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
const QChar &la, int *skippedChars) const;
QString insertParagraphSeparator(const QTextCursor &tc) const;