Made typing parenthesis even faster

Only attempt to activate the completion when there is a function id on
the left of the parenthesis.

Reviewed-by: Roberto Raggi
This commit is contained in:
Thorbjørn Lindeijer
2009-05-27 11:12:06 +02:00
parent 39b0da2a1e
commit efc0b20859
4 changed files with 36 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ TokenUnderCursor::TokenUnderCursor()
TokenUnderCursor::~TokenUnderCursor()
{ }
SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *b) const
SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *b)
{
SimpleLexer tokenize;
tokenize.setObjCEnabled(true);
@@ -51,9 +51,9 @@ SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *
QTextBlock block = cursor.block();
int column = cursor.columnNumber();
QList<SimpleToken> tokens = tokenize(block.text(), previousBlockState(block));
for (int index = tokens.size() - 1; index != -1; --index) {
const SimpleToken &tk = tokens.at(index);
_tokens = tokenize(block.text(), previousBlockState(block));
for (int index = _tokens.size() - 1; index != -1; --index) {
const SimpleToken &tk = _tokens.at(index);
if (tk.position() < column) {
if (b)
*b = block;