Skip to content

Commit

Permalink
Fix emoji search in dictionary (#234)
Browse files Browse the repository at this point in the history
The commit b2ee902 introduced regression in whole places where smilies are used. Now it seems to be fixed.
Thanks for testing for @saphire , @Randl and @zgwerby for reporting issue #233 .
Closes #233.
  • Loading branch information
Randl authored and leha-bot committed Jun 24, 2019
1 parent e164760 commit d0de5d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit d0de5d3

Please sign in to comment.