summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-21 14:21:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-21 14:21:56 +0000
commit4c9918cd61ada1d0e69402128b9030b5e5a7d3a1 (patch)
tree327c9d9a80007e26f9bb5c84b74d22b70f6f1d5d /plugins/TabSRMM
parentef0096475288bd6a1a3463d8a437954862e85e66 (diff)
fix against speller
git-svn-id: http://svn.miranda-ng.org/main/trunk@12233 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp17
1 files changed, 12 insertions, 5 deletions
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;