Fixed `look at symbol under cursor' when symbol is a Qt method (e.g. a signal).

Done with: erikv
This commit is contained in:
Roberto Raggi
2010-03-29 15:30:53 +02:00
parent a67e88993b
commit 678f7d3e94
8 changed files with 105 additions and 38 deletions

View File

@@ -28,6 +28,7 @@
**************************************************************************/
#include "TokenUnderCursor.h"
#include "BackwardsScanner.h"
#include <Token.h>
#include <QTextCursor>
@@ -52,7 +53,7 @@ SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *
int column = cursor.position() - cursor.block().position();
_text = block.text();
_tokens = tokenize(_text, previousBlockState(block));
_tokens = tokenize(_text, BackwardsScanner::previousBlockState(block));
for (int index = _tokens.size() - 1; index != -1; --index) {
const SimpleToken &tk = _tokens.at(index);
if (tk.position() < column) {
@@ -64,15 +65,3 @@ SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor, QTextBlock *
return SimpleToken();
}
int TokenUnderCursor::previousBlockState(const QTextBlock &block) const
{
const QTextBlock prevBlock = block.previous();
if (prevBlock.isValid()) {
int state = prevBlock.userState();
if (state != -1)
return state;
}
return 0;
}