Automagically insert matching characters.

This commit is contained in:
Roberto Raggi
2009-09-17 17:57:17 +02:00
parent 245dfe51c6
commit 82b80b9e39
7 changed files with 145 additions and 10 deletions

View File

@@ -32,7 +32,7 @@
using namespace CPlusPlus;
BackwardsScanner::BackwardsScanner(const QTextCursor &cursor, int maxBlockCount)
BackwardsScanner::BackwardsScanner(const QTextCursor &cursor, const QString &suffix, int maxBlockCount)
: _offset(0)
, _blocksTokenized(0)
, _block(cursor.block())
@@ -40,6 +40,10 @@ BackwardsScanner::BackwardsScanner(const QTextCursor &cursor, int maxBlockCount)
{
_tokenize.setSkipComments(true);
_text = _block.text().left(cursor.position() - cursor.block().position());
if (! suffix.isEmpty())
_text += suffix;
_tokens.append(_tokenize(_text, previousBlockState(_block)));
}