Strip EOL characters from wxStyledTextCtrl::GetLineText() return value.
For consistency with all the other wxTextCtrl-like classes, the value returned by this method must not include line terminator characters (like '\n'). Notice that Scintilla-specific GetLine() does still include them, for consistency with the Scintilla API itself. Closes #13646. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e0fddcefb6
commit
cd41ef6f51
@ -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<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(); }
|
||||
|
@ -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<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(); }
|
||||
|
Loading…
Reference in New Issue
Block a user