aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/ScintillaWin.cxx46
1 files changed, 1 insertions, 45 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 99a54c1aa..6847d4a83 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -2206,11 +2206,7 @@ void ScintillaWin::CopyAllowLine() {
bool ScintillaWin::CanPaste() {
if (!Editor::CanPaste())
return false;
- if (::IsClipboardFormatAvailable(CF_TEXT))
- return true;
- if (IsUnicodeMode())
- return ::IsClipboardFormatAvailable(CF_UNICODETEXT) != 0;
- return false;
+ return ::IsClipboardFormatAvailable(CF_UNICODETEXT) != FALSE;
}
namespace {
@@ -2324,38 +2320,6 @@ void ScintillaWin::Paste() {
InsertPasteShape(&putf[0], len, pasteShape);
}
memUSelection.Unlock();
- } else {
- // CF_UNICODETEXT not available, paste ANSI text
- GlobalMemory memSelection(::GetClipboardData(CF_TEXT));
- if (memSelection) {
- const char *ptr = static_cast<const char *>(memSelection.ptr);
- if (ptr) {
- const size_t bytes = memSelection.Size();
- size_t len = bytes;
- for (size_t i = 0; i < bytes; i++) {
- if ((len == bytes) && (0 == ptr[i]))
- len = i;
- }
-
- // In Unicode mode, convert clipboard text to UTF-8
- if (IsUnicodeMode()) {
- std::vector<wchar_t> uptr(len+1);
-
- const size_t ulen = WideCharFromMultiByte(CP_ACP,
- std::string_view(ptr, len), &uptr[0], len + 1);
-
- const std::wstring_view wsv(&uptr[0], ulen);
- const size_t mlen = UTF8Length(wsv);
- std::vector<char> putf(mlen+1);
- UTF8FromUTF16(wsv, &putf[0], mlen);
-
- InsertPasteShape(&putf[0], mlen, pasteShape);
- } else {
- InsertPasteShape(ptr, len, pasteShape);
- }
- }
- memSelection.Unlock();
- }
}
::CloseClipboard();
Redraw();
@@ -2867,14 +2831,6 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) {
if (uniText) {
uniText.SetClip(CF_UNICODETEXT);
- } else {
- // There was a failure - try to copy at least ANSI text
- GlobalMemory ansiText;
- ansiText.Allocate(selectedText.LengthWithTerminator());
- if (ansiText) {
- memcpy(ansiText.ptr, selectedText.Data(), selectedText.LengthWithTerminator());
- ansiText.SetClip(CF_TEXT);
- }
}
if (selectedText.rectangular) {