From 87c02d014a70340c62ec4db161a5bae90dd5cf88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 3 May 2017 14:33:15 +0300 Subject: winapi perversion removed (fixes #809) --- plugins/Scriver/src/msgdialog.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 9a92590931..cebfea6c55 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -434,26 +434,18 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) pf2.dwMask = PFM_RTLPARA; m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2); - int bufSize = m_message.GetRichTextLength(1200) + 2; - ptrW ptszUnicode((wchar_t*)mir_alloc(bufSize * sizeof(wchar_t))); - MessageSendQueueItem msi = { 0 }; if (pf2.wEffects & PFE_RTLPARA) msi.flags |= PREF_RTL; - GETTEXTEX gt = { 0 }; - gt.flags = GT_DEFAULT; - gt.cb = bufSize * sizeof(wchar_t); - gt.codepage = 1200; // Unicode - m_message.SendMsg(EM_GETTEXTEX, (WPARAM)>, ptszUnicode); - if (Utils_IsRtl(ptszUnicode)) - msi.flags |= PREF_RTL; - - msi.sendBuffer = mir_utf8encodeW(ptszUnicode); + msi.sendBuffer = m_message.GetRichTextUtf(); msi.sendBufferSize = (int)mir_strlen(msi.sendBuffer); if (msi.sendBufferSize == 0) return; + if (Utils_IsRtl(ptrW(mir_utf8decodeW(msi.sendBuffer)))) + msi.flags |= PREF_RTL; + /* Store messaging history */ TCmdList *cmdListNew = tcmdlist_last(cmdList); while (cmdListNew != nullptr && cmdListNew->temporary) { -- cgit v1.2.3