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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user