*/
- 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(); }
// 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<int>(GetLineText(lineNo).length()); }
+ virtual wxString GetLineText(long lineNo) const
+ {
+ wxString text = GetLine(static_cast<int>(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(); }