diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 7ff979bbf..f45c4e626 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -319,6 +319,13 @@ struct HorizontalScrollRange { int documentWidth; }; +CLIPFORMAT RegisterClipboardType(LPCWSTR lpszFormat) noexcept { + // Registered clipboard format values are 0xC000 through 0xFFFF. + // RegisterClipboardFormatW returns 32-bit unsigned and CLIPFORMAT is 16-bit + // unsigned so choose the low 16-bits with &. + return ::RegisterClipboardFormatW(lpszFormat) & 0xFFFF; +} + } namespace Scintilla::Internal { @@ -572,16 +579,12 @@ ScintillaWin::ScintillaWin(HWND hwnd) { // There does not seem to be a real standard for indicating that the clipboard // contains a rectangular selection, so copy Developer Studio and Borland Delphi. - cfColumnSelect = static_cast<CLIPFORMAT>( - ::RegisterClipboardFormat(TEXT("MSDEVColumnSelect"))); - cfBorlandIDEBlockType = static_cast<CLIPFORMAT>( - ::RegisterClipboardFormat(TEXT("Borland IDE Block Type"))); + cfColumnSelect = RegisterClipboardType(L"MSDEVColumnSelect"); + cfBorlandIDEBlockType = RegisterClipboardType(L"Borland IDE Block Type"); // Likewise for line-copy (copies a full line when no text is selected) - cfLineSelect = static_cast<CLIPFORMAT>( - ::RegisterClipboardFormat(TEXT("MSDEVLineSelect"))); - cfVSLineTag = static_cast<CLIPFORMAT>( - ::RegisterClipboardFormat(TEXT("VisualStudioEditorOperationsLineCutCopyClipboardTag"))); + cfLineSelect = RegisterClipboardType(L"MSDEVLineSelect"); + cfVSLineTag = RegisterClipboardType(L"VisualStudioEditorOperationsLineCutCopyClipboardTag"); hrOle = E_FAIL; wMain = hwnd; |