Fix calculation of the wxStyledTextCtrl selection size.

Use SCI_GETSELTEXT to compute the size of the buffer instead of doing it
ourselves, especially as we do it incorrectly in case of rectangular
selection.

Closes #14331.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-05-23 21:16:24 +00:00
parent 0bcbf72bdc
commit 1a692f0f22
2 changed files with 6 additions and 18 deletions

View File

@@ -4128,16 +4128,10 @@ wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
{
long start;
long end;
GetSelection(&start, &end);
int len = end - start;
if (!len) {
wxCharBuffer empty;
return empty;
}
// Calculate the length needed first.
const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
// And then really get the data.
wxCharBuffer buf(len);
SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
return buf;