Improve wxTextCtrl::GetNumberOfLines() unit test and documentation.
First, enable execution of the Lines() wxTextCtrl unit test case under wxOSX as it passes since the fix in the previous commit. Do add a test for GetNumberOfLines() that currently doesn't work in the same way under all platforms -- but with this test we at least can be sure how does it work exactly where. Also mention the current discrepancy in this function behaviour in the documentation. See #12366. Fix Lines() wxTextCtrl unit test to pass under wxGTK too. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1197,19 +1197,15 @@ public:
|
||||
/**
|
||||
Returns the number of lines in the text control buffer.
|
||||
|
||||
The returned number is the number of logical lines, i.e. just the count
|
||||
of the number of newline characters in the control + 1, for wxGTK and
|
||||
wxOSX/Cocoa ports while it is the number of physical lines, i.e. the
|
||||
count of lines actually shown in the control, in wxMSW and wxOSX/Carbon.
|
||||
Because of this discrepancy, it is not recommended to use this function.
|
||||
|
||||
@remarks
|
||||
Note that even empty text controls have one line (where the
|
||||
insertion point is), so GetNumberOfLines() never returns 0.
|
||||
For wxGTK using GTK+ 1.2.x and earlier, the number of lines in a
|
||||
multi-line text control is calculated by actually counting newline
|
||||
characters in the buffer, i.e. this function returns the number of
|
||||
logical lines and doesn't depend on whether any of them are wrapped.
|
||||
For all the other platforms, the number of physical lines in the
|
||||
control is returned.
|
||||
Also note that you may wish to avoid using functions that work with
|
||||
line numbers if you are working with controls that contain large
|
||||
amounts of text as this function has O(N) complexity for N being
|
||||
the number of lines.
|
||||
*/
|
||||
virtual int GetNumberOfLines() const;
|
||||
|
||||
|
Reference in New Issue
Block a user