Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix emoji search #234

Merged
merged 1 commit into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Telegram/SourceFiles/codegen/common/cpp_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void writeLicense(QTextStream &stream, const ProjectInfo &project) {
CppFile::CppFile(const QString &path, const ProjectInfo &project)
: stream_(&content_)
, forceReGenerate_(project.forceReGenerate) {
stream_.setCodec("UTF-8");
bool cpp = path.toLower().endsWith(".cpp");

QFileInfo info(path);
Expand Down
8 changes: 4 additions & 4 deletions Telegram/SourceFiles/codegen/emoji/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ const std::map<QString, int> EmojiMap = {\n\
\n";

for (auto &item : data_.map) {
source_->stream() << "{\"" << item.first << "\"," << item.second << "},\n";
source_->stream() << "{QString(\"" << item.first << "\")," << item.second << "},\n";
}
source_->stream() << "\
\n\
Expand Down Expand Up @@ -674,10 +674,10 @@ bool Generator::writeFindFromDictionary(const std::map<QString, int, std::greate
auto max_length = max_el->first.size();
source_->stream() << "\tstd::array<size_t, " << max_length + 1 << "> sizes;\n";
if (skipPostfixes) {
source_->stream() << "\tfor (int i=0,l=0; i<str.size() && l < " << max_length << R"code(; ++i) {
if (str[i] == kPostfix) {continue;}
source_->stream() << "\tfor (int i=0,l=0; i<full_str.size() && l < " << max_length << R"code(; ++i) {
if (full_str[i] == kPostfix) {continue;}
++l;
sizes[l]=i;
sizes[l]=i+1;
str+=full_str[i];
}
)code";
Expand Down