From 1456e68e9391dad5c101e940425770cda54ff5a3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Jan 2020 23:11:05 +0300 Subject: =?UTF-8?q?fixes=20#2159=20(BBCode=20color.=20=D0=9D=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=91=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B2=20=D1=82=D0=B5=D0=B3=D0=B5=20=D1=86=D0=B2=D0=B5=D1=82=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=B5=20?= =?UTF-8?q?=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20=D0=BF=D0=BE=20=D0=BA=D0=BD?= =?UTF-8?q?=D0=BE=D0=BF=D0=BA=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/TabSRMM/src/utils.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'plugins/TabSRMM') 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])); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3