| 53 | } |
| 54 | |
| 55 | void AutoCompletion::InitSuggestions(std::string_view text) |
| 56 | { |
| 57 | this->initial_buf = text; |
| 58 | size_t space_pos = this->initial_buf.find_last_of(' '); |
| 59 | this->query = this->initial_buf; |
| 60 | if (space_pos == std::string::npos) { |
| 61 | this->prefix = ""; |
| 62 | } else { |
| 63 | this->prefix = this->query.substr(0, space_pos + 1); |
| 64 | this->query.remove_prefix(space_pos + 1); |
| 65 | } |
| 66 | |
| 67 | this->suggestions = this->GetSuggestions(prefix, query); |
| 68 | this->current_suggestion_index = 0; |
| 69 | } |
no test coverage detected