diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index ca27bc89f7..f71fe5f772 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -4629,7 +4629,17 @@ public: // --------------------------------------------- virtual int GetLineLength(long n) const { return GetLine(n).length(); } - virtual wxString GetLineText(long n) const { return GetLine(n); } + virtual wxString GetLineText(long lineNo) const + { + wxString text = GetLine(static_cast(lineNo)); + size_t lastNewLine = text.find_last_not_of(wxS("\r\n")); + + if ( lastNewLine != wxString::npos ) + text.erase(lastNewLine + 1); // remove trailing cr+lf + else + text.clear(); + return text; + } virtual int GetNumberOfLines() const { return GetLineCount(); } virtual bool IsModified() const { return GetModify(); } diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index abbfe19b2a..e4b3a05406 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -371,7 +371,17 @@ public: // --------------------------------------------- virtual int GetLineLength(long n) const { return GetLine(n).length(); } - virtual wxString GetLineText(long n) const { return GetLine(n); } + virtual wxString GetLineText(long lineNo) const + { + wxString text = GetLine(static_cast(lineNo)); + size_t lastNewLine = text.find_last_not_of(wxS("\r\n")); + + if ( lastNewLine != wxString::npos ) + text.erase(lastNewLine + 1); // remove trailing cr+lf + else + text.clear(); + return text; + } virtual int GetNumberOfLines() const { return GetLineCount(); } virtual bool IsModified() const { return GetModify(); }