| 5459 | } |
| 5460 | |
| 5461 | static bool isAlreadyClosedTag( TextDocument* doc, TextPosition start, |
| 5462 | size_t maxSearchTokens = 1000 ) { |
| 5463 | SyntaxHighlighter* highlighter = doc->getHighlighter(); |
| 5464 | TextPosition endOfDoc = doc->endOfDoc(); |
| 5465 | do { |
| 5466 | String::StringBaseType ch = doc->getChar( start ); |
| 5467 | switch ( ch ) { |
| 5468 | case '>': { |
| 5469 | auto tokenType = highlighter->getTokenTypeAt( start ); |
| 5470 | if ( tokenType != "comment"_sst && tokenType != "string"_sst ) |
| 5471 | return true; |
| 5472 | break; |
| 5473 | } |
| 5474 | case '<': { |
| 5475 | auto tokenType = highlighter->getTokenTypeAt( start ); |
| 5476 | if ( tokenType != "comment"_sst && tokenType != "string"_sst ) |
| 5477 | return false; |
| 5478 | break; |
| 5479 | } |
| 5480 | default: |
| 5481 | break; |
| 5482 | } |
| 5483 | start = doc->positionOffset( start, 1 ); |
| 5484 | } while ( start.isValid() && start != endOfDoc && --maxSearchTokens ); |
| 5485 | return false; |
| 5486 | } |
| 5487 | |
| 5488 | bool UICodeEditor::checkAutoCloseXMLTag( const String& text ) { |
| 5489 | if ( !mAutoCloseXMLTags || text.empty() || text.size() > 1 || text[0] != '>' || |
no test coverage detected