forked from qt-creator/qt-creator
		
	Added BackwardsScanner::mid(tokenIndex). Mid() returns a substring starting from the position of the given token.
This commit is contained in:
		| @@ -99,6 +99,12 @@ int BackwardsScanner::startPosition() const | ||||
| QString BackwardsScanner::text() const | ||||
| { return _text; } | ||||
|  | ||||
| QString BackwardsScanner::mid(int index) const | ||||
| { | ||||
|     const SimpleToken &firstToken = _tokens.at(index + _offset); | ||||
|     return _text.mid(firstToken.begin()); | ||||
| } | ||||
|  | ||||
| QString BackwardsScanner::text(int index) const | ||||
| { | ||||
|     const SimpleToken &firstToken = _tokens.at(index + _offset); | ||||
|   | ||||
| @@ -51,9 +51,10 @@ public: | ||||
|     int startPosition() const; | ||||
|  | ||||
|     QString text() const; | ||||
|     QString mid(int index) const; | ||||
|  | ||||
|     QString text(int index) const; | ||||
|     QStringRef textRef(int index) const; | ||||
|  | ||||
|     // 1-based | ||||
|     SimpleToken LA(int index) const; | ||||
|  | ||||
|   | ||||
| @@ -150,7 +150,7 @@ QString ExpressionUnderCursor::operator()(const QTextCursor &cursor) | ||||
|     if (i == initialSize) | ||||
|         return QString(); | ||||
|  | ||||
|     return scanner.text(i); | ||||
|     return scanner.mid(i); | ||||
| } | ||||
|  | ||||
| int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const | ||||
|   | ||||
		Reference in New Issue
	
	Block a user