]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp
Various compile fixes.
[wxWidgets.git] / src / stc / stc.cpp
index 2d9c445db3f2a42aa395dbb0b6f259b3ba80a1a9..520ebd5cb99d1e59ee6cbbeed5ca14939d7ad4b4 100644 (file)
@@ -143,6 +143,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
               style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
               wxDefaultValidator, name)
 {
               style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
               wxDefaultValidator, name)
 {
+    wxForceScintillaLexers();
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
     m_lastKeyDownConsumed = FALSE;
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
     m_lastKeyDownConsumed = FALSE;
@@ -275,6 +276,11 @@ void wxStyledTextCtrl::SetSavePoint() {
 // Retrieve a buffer of cells.
 wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
                           wxString text;
 // 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;
                           int len = endPos - startPos;
                           if (!len) return "";
                           TextRange tr;
@@ -972,6 +978,11 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
                                 wxRect pageRect) {
                             RangeToFormat fr;
 
                                 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();
                             fr.hdc = draw;
                             fr.hdcTarget = target;
                             fr.rc.top = renderRect.GetTop();
@@ -1060,6 +1071,11 @@ wxString wxStyledTextCtrl::GetSelectedText() {
 // Retrieve a range of text.
 wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
                             wxString text;
 // 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);
                             int   len  = endPos - startPos;
                             if (!len) return "";
                             char* buff = text.GetWriteBuf(len);