X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d7b19b01379566b9f18a0e17f74afc2080dcf2c..a4f6fe43c33bd7933645d110ad2719871dab043d:/include/wx/stc/stc.h diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index ca27bc89f7..c406e6a687 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -4577,7 +4577,10 @@ public: */ - virtual void SetInsertionPoint(long pos) { SetCurrentPos(pos); } + virtual void SetInsertionPoint(long pos) + { + SetCurrentPos(pos == -1 ? GetLastPosition() : pos); + } virtual long GetInsertionPoint() const { return GetCurrentPos(); } virtual long GetLastPosition() const { return GetTextLength(); } @@ -4628,8 +4631,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(); }