X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4eb77d8bce9c29fe465f2fad3a8e5f3b1c6b6e62..bd2e08d06528b2014a4acf878e91fee4696d0666:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 9293dcebb7..c8173d7fc7 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -784,10 +784,12 @@ wxString wxTextCtrl::GetRange(long from, long to) const encoding = font.GetEncoding(); } +#if wxUSE_INTL if ( encoding == wxFONTENCODING_SYSTEM ) { encoding = wxLocale::GetSystemEncoding(); } +#endif // wxUSE_INTL if ( encoding == wxFONTENCODING_SYSTEM ) { @@ -974,6 +976,9 @@ wxTextCtrl::StreamIn(const wxString& value, const size_t len = conv.MB2WC(NULL, value.mb_str(), value.length()); + if (len == wxCONV_FAILED) + return false; + #if wxUSE_WCHAR_T wxWCharBuffer wchBuf(len); wchar_t *wpc = wchBuf.data(); @@ -1066,7 +1071,8 @@ wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const // conversion but what else can we do) wxCSConv conv(encoding); size_t lenNeeded = conv.WC2MB(NULL, wchBuf, 0); - if ( lenNeeded++ ) + + if ( lenNeeded != wxCONV_FAILED && lenNeeded++ ) { conv.WC2MB(wxStringBuffer(out, lenNeeded), wchBuf, lenNeeded); } @@ -1299,6 +1305,13 @@ void wxTextCtrl::DoSetSelection(long from, long to, int flags) #if wxUSE_RICHEDIT if ( IsRich() ) { + // if from and to are both -1, it means (in wxWidgets) that all text + // should be selected, translate this into Windows convention + if ( (from == -1) && (to == -1) ) + { + from = 0; + } + CHARRANGE range; range.cpMin = from; range.cpMax = to; @@ -1877,13 +1890,6 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara } } break; - - case WM_CUT: - case WM_COPY: - case WM_PASTE: - if ( HandleClipboardEvent(nMsg) ) - lRc = 0; - break; } return lRc;