diff options
author | George Hazan <ghazan@miranda.im> | 2022-09-26 19:16:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-09-26 19:16:12 +0300 |
commit | c5dc28ec2272a865ef2f28fd7ab151b55517fedf (patch) | |
tree | d751f3e869c66371b8f1d65480b39c2997ba6e62 /plugins/Msg_Export/src | |
parent | dc2a4dc50d6cc3e7bd513122756dd39141d7887e (diff) |
more clipboard shit removed
Diffstat (limited to 'plugins/Msg_Export/src')
-rw-r--r-- | plugins/Msg_Export/src/FileViewer.cpp | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 6390f435e1..f6f018936b 100644 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -548,41 +548,33 @@ bool bAdvancedCopy(HWND hwnd) CHARRANGE sSelectRange;
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sSelectRange);
int nSelLenght = sSelectRange.cpMax - sSelectRange.cpMin + 1; // +1 for null termination
- if (nSelLenght > 1) {
- if (OpenClipboard(nullptr)) {
- EmptyClipboard();
-
- wchar_t *pszSrcBuf = new wchar_t[nSelLenght];
- pszSrcBuf[0] = 0;
- SendMessage(hwnd, EM_GETSELTEXT, 0, (LPARAM)pszSrcBuf);
-
- HANDLE hDecMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, nSelLenght * sizeof(wchar_t));
- wchar_t *pszCurDec = (wchar_t*)GlobalLock(hDecMem);
-
- bool bInSpaces = false;
- for (wchar_t *pszCur = pszSrcBuf; pszCur[0]; pszCur++) {
- if (bInSpaces) {
- if (pszCur[0] == ' ')
- continue;
- bInSpaces = false;
- }
+ if (nSelLenght <= 1)
+ return false;
- if (pszCur[0] == '\n')
- bInSpaces = true;
+ wchar_t *pszSrcBuf = new wchar_t[nSelLenght];
+ pszSrcBuf[0] = 0;
+ SendMessage(hwnd, EM_GETSELTEXT, 0, (LPARAM)pszSrcBuf);
- pszCurDec[0] = pszCur[0];
- pszCurDec++;
- }
- pszCurDec[0] = 0;
- GlobalUnlock(hDecMem);
+ wchar_t *pszCurDec = pszSrcBuf;
- SetClipboardData(CF_UNICODETEXT, hDecMem);
- delete[] pszSrcBuf;
- CloseClipboard();
- return true;
+ bool bInSpaces = false;
+ for (wchar_t *pszCur = pszSrcBuf; pszCur[0]; pszCur++) {
+ if (bInSpaces) {
+ if (pszCur[0] == ' ')
+ continue;
+ bInSpaces = false;
}
+
+ if (pszCur[0] == '\n')
+ bInSpaces = true;
+
+ *pszCurDec = *pszCur;
+ pszCurDec++;
}
- return false;
+ pszCurDec[0] = 0;
+ Utils_ClipboardCopy(pszSrcBuf);
+ delete[] pszSrcBuf;
+ return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
|