From 4c9918cd61ada1d0e69402128b9030b5e5a7d3a1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 21 Feb 2015 14:21:56 +0000 Subject: fix against speller git-svn-id: http://svn.miranda-ng.org/main/trunk@12233 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/msgdlgutils.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'plugins/TabSRMM/src/msgdlgutils.cpp') diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index ae11b83a27..5c223cbf5c 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -843,6 +843,8 @@ char* TSAPI Message_GetFromStream(HWND hwndRtf, const TWindowData *dat, DWORD dw // convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting // tags and return plain text +static TCHAR tszRtfBreaks[] = _T(" \\\n\r"); + BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText) { if (pszText.IsEmpty()) @@ -860,7 +862,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText) if (idx == -1) return FALSE; - bool bInsideColor = false; + bool bInsideColor = false, bInsideUl = false; CMString res; // iterate through all characters, if rtf control character found then take action @@ -920,10 +922,15 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText) } else if (!_tcsncmp(p, _T("\\ul"), 3)) { // underlined if (!lf.lfUnderline && dat->SendFormat) { - if (p[3] == '0') + if (p[3] == 0 || _tcschr(tszRtfBreaks, p[3])) { res.Append(_T("[u]")); - else if (p[3] == '1') - res.Append(_T("[/u]")); + bInsideUl = true; + } + else if (!_tcsnccmp(p + 3, _T("none"), 4)) { + if (bInsideUl) + res.Append(_T("[/u]")); + bInsideUl = false; + } } } else if (!_tcsncmp(p, _T("\\tab"), 4)) { // tab @@ -955,7 +962,7 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText) } p++; // skip initial slash - p += _tcscspn(p, _T(" \\\n\r")); + p += _tcscspn(p, tszRtfBreaks); if (*p == ' ') p++; break; -- cgit v1.2.3