Return -1 from GetLineLength() if line number is out of range
Make wxTextCtrl behaviour in all ports consistent with the documentation and also update wxStyledTextCtrl to behave accordingly. Closes #18431.
This commit is contained in:
committed by
Vadim Zeitlin
parent
6e556d4a71
commit
c3ce5244e3
@@ -5333,7 +5333,14 @@ public:
|
||||
// implement wxTextAreaBase pure virtual methods
|
||||
// ---------------------------------------------
|
||||
|
||||
virtual int GetLineLength(long lineNo) const wxOVERRIDE { return static_cast<int>(GetLineText(lineNo).length()); }
|
||||
virtual int GetLineLength(long lineNo) const wxOVERRIDE
|
||||
{
|
||||
if ( lineNo < 0 || lineNo >= GetNumberOfLines() )
|
||||
return -1;
|
||||
|
||||
return static_cast<int>(GetLineText(lineNo).length());
|
||||
}
|
||||
|
||||
virtual wxString GetLineText(long lineNo) const wxOVERRIDE
|
||||
{
|
||||
wxString text = GetLine(static_cast<int>(lineNo));
|
||||
|
Reference in New Issue
Block a user