summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-26 23:11:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-26 23:11:05 +0300
commit1456e68e9391dad5c101e940425770cda54ff5a3 (patch)
treee5e83897f956c57e6033800c0335993c8ed82ef2 /plugins/TabSRMM
parentf6076b88348538fb45d38636bc7e1b8925278a03 (diff)
fixes #2159 (BBCode color. Не передаётся в теге цвет при выборе цвета по кнопке)
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/utils.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index dd5d46f2e0..80a21c2c9d 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -77,18 +77,18 @@ void CMsgDialog::FormatRaw(CMStringW &msg, int flags, bool isSent)
continue;
}
- CMStringW colorname = msg.Mid(beginmark + 7, 8);
+ CMStringW colorname = msg.Mid(beginmark + 7, closing - beginmark - 7);
search_again:
bool clr_found = false;
for (int ii = 0; ii < Utils::rtf_clrs.getCount(); ii++) {
auto &rtfc = Utils::rtf_clrs[ii];
- if (!wcsnicmp(colorname, rtfc.szName, mir_wstrlen(rtfc.szName))) {
+ if (!wcsicmp(colorname, rtfc.szName)) {
closing = beginmark + 7 + (int)mir_wstrlen(rtfc.szName);
if (endmark != -1) {
msg.Delete(endmark, 8);
msg.Insert(endmark, L"c0 ");
}
- msg.Delete(beginmark, (closing - beginmark));
+ msg.Delete(beginmark, closing - beginmark + 1);
wchar_t szTemp[5];
msg.Insert(beginmark, L"cxxx ");
@@ -413,12 +413,18 @@ int CMsgDialog::FindRTLLocale()
/////////////////////////////////////////////////////////////////////////////////////////
// init default color table. the table may grow when using custom colors via bbcodes
+static const wchar_t *sttColorNames[] = {
+ L"black",
+ L"", L"", L"", L"", L"", L"", L"", L"",
+ L"blue", L"cyan", L"magenta", L"green", L"yellow", L"red", L"white"
+};
+
void Utils::RTF_CTableInit()
{
int iTableSize;
COLORREF *pTable = Srmm_GetColorTable(&iTableSize);
for (int i = 0; i < iTableSize; i++)
- rtf_clrs.insert(new TRTFColorTable(L"", pTable[i]));
+ rtf_clrs.insert(new TRTFColorTable(sttColorNames[i], pTable[i]));
}
/////////////////////////////////////////////////////////////////////////////////////////