diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-22 20:49:10 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-22 20:49:14 +0300 |
commit | 444a4a54745a33980b8d5bbe156cffaa3981f2ad (patch) | |
tree | 1ba8bff901b2e68d99f9ce63705606bb1db4317b /plugins/NewStory/src/templates.cpp | |
parent | dcdb21120dd5ebe75e70149844ee67498957f1d2 (diff) |
fix for the multiple emoji drawing
Diffstat (limited to 'plugins/NewStory/src/templates.cpp')
-rw-r--r-- | plugins/NewStory/src/templates.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index 3c7b01eb4b..298141b943 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -156,19 +156,22 @@ CMStringW ItemData::formatHtml(const wchar_t *pwszStr) AppendString(szBody, wszOrigText);
UrlAutodetect(szBody);
if (spRes) {
+ int iOffset = 0;
for (int i = 0; i < (int)sp.numSmileys; i++) {
auto &smiley = spRes[i];
if (!mir_wstrlen(smiley.filepath))
continue;
CMStringW wszFound(wszOrigText.Mid(smiley.startChar, smiley.size));
- int idx = szBody.Find(wszFound);
+ int idx = szBody.Find(wszFound, iOffset);
if (idx == -1)
continue;
szBody.Delete(idx, smiley.size);
- szBody.Insert(idx, CMStringW(FORMAT, L"<img class=\"img\" src=\"file://%s\" title=\"%s\" alt=\"%s\" />",
- smiley.filepath, wszFound.c_str(), wszFound.c_str()));
+
+ CMStringW wszNew(FORMAT, L"<img class=\"img\" src=\"file://%s\" title=\"%s\" alt=\"%s\" />", smiley.filepath, wszFound.c_str(), wszFound.c_str());
+ szBody.Insert(idx, wszNew);
+ iOffset = idx + wszNew.GetLength();
}
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)spRes);
|