X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d7b19b01379566b9f18a0e17f74afc2080dcf2c..ab67e8874db324fab5223cc8d5dff8a8de3e2b77:/include/wx/stc/stc.h?ds=inline diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index ca27bc89f7..1edf28158e 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -4628,8 +4628,18 @@ public: // implement wxTextAreaBase pure virtual methods // --------------------------------------------- - virtual int GetLineLength(long n) const { return GetLine(n).length(); } - virtual wxString GetLineText(long n) const { return GetLine(n); } + virtual int GetLineLength(long lineNo) const { return static_cast(GetLineText(lineNo).length()); } + 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(); }