| 618 | } |
| 619 | |
| 620 | TypedArray<int> ScriptLanguage::CodeCompletionOption::get_option_characteristics(const String &p_base) { |
| 621 | if (last_matches == matches) { |
| 622 | return charac; |
| 623 | } |
| 624 | charac.clear(); |
| 625 | // Ensure base is not empty and at the same time that matches is not empty too. |
| 626 | if (p_base.length() == 0) { |
| 627 | last_matches = matches; |
| 628 | charac.push_back(location); |
| 629 | return charac; |
| 630 | } |
| 631 | charac.push_back(matches.size()); |
| 632 | charac.push_back((matches[0].first == 0) ? 0 : 1); |
| 633 | const char32_t *target_char = &p_base[0]; |
| 634 | int bad_case = 0; |
| 635 | for (const Pair<int, int> &match_segment : matches) { |
| 636 | const char32_t *string_to_complete_char = &display[match_segment.first]; |
| 637 | for (int j = 0; j < match_segment.second; j++, string_to_complete_char++, target_char++) { |
| 638 | if (*string_to_complete_char != *target_char) { |
| 639 | bad_case++; |
| 640 | } |
| 641 | } |
| 642 | } |
| 643 | charac.push_back(bad_case); |
| 644 | charac.push_back(location); |
| 645 | charac.push_back(matches[0].first); |
| 646 | last_matches = matches; |
| 647 | return charac; |
| 648 | } |
| 649 | |
| 650 | void ScriptLanguage::CodeCompletionOption::clear_characteristics() { |
| 651 | charac = TypedArray<int>(); |
no test coverage detected