X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32083aa0de6e1e8940953dd69ad4be41f2f54c70..0d1dff0172e94487c4aa2d830c714f93be73c7ec:/contrib/src/stc/stc.cpp diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index b2da830400..520ebd5cb9 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -276,6 +276,11 @@ void wxStyledTextCtrl::SetSavePoint() { // Retrieve a buffer of cells. wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) { wxString text; + if (endPos < startPos) { + int temp = startPos; + startPos = endPos; + endPos = temp; + } int len = endPos - startPos; if (!len) return ""; TextRange tr; @@ -973,6 +978,11 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos, wxRect pageRect) { RangeToFormat fr; + if (endPos < startPos) { + int temp = startPos; + startPos = endPos; + endPos = temp; + } fr.hdc = draw; fr.hdcTarget = target; fr.rc.top = renderRect.GetTop(); @@ -1061,6 +1071,11 @@ wxString wxStyledTextCtrl::GetSelectedText() { // Retrieve a range of text. wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) { wxString text; + if (endPos < startPos) { + int temp = startPos; + startPos = endPos; + endPos = temp; + } int len = endPos - startPos; if (!len) return ""; char* buff = text.GetWriteBuf(len);