return NULL;
// XXX: use an std::set?
- typedef std::vector<std::string> Completions;
+ typedef std::vector<CYUTF8String> Completions;
Completions completions;
std::string common;
CYString *string(dynamic_cast<CYString *>(value->value_));
_assert(string != NULL);
- std::string completion;
+ CYUTF8String completion;
if (string->size_ != 0)
- completion.assign(string->value_, string->size_);
+ completion = {string->value_, string->size_};
else if (driver.mode_ == CYDriver::AutoMessage)
completion = "]";
else
continue;
+ if (CYStartsWith(completion, "$cy"))
+ continue;
+
completions.push_back(completion);
if (!rest) {
common = completion;
rest = true;
} else {
- size_t limit(completion.size()), size(common.size());
+ size_t limit(completion.size), size(common.size());
if (size > limit)
common = common.substr(0, limit);
else
limit = size;
for (limit = 0; limit != size; ++limit)
- if (common[limit] != completion[limit])
+ if (common[limit] != completion.data[limit])
break;
if (limit != size)
common = common.substr(0, limit);
results[0] = strdup(common.c_str());
size_t index(0);
for (Completions::const_iterator i(completions.begin()); i != completions.end(); ++i)
- results[++index] = strdup(i->c_str());
+ results[++index] = strdup(i->data);
results[count + 1] = NULL;
return results;