MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / InitSuggestions

Method InitSuggestions

src/autocompletion.cpp:55–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void 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}

Callers 1

AutoCompleteMethod · 0.95

Calls 2

substrMethod · 0.80
GetSuggestionsMethod · 0.45

Tested by

no test coverage detected