Prevents crashes caused by negative line count being passed to wrapping functions, e.g. in intermediate sizing states.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2006-09-04 19:57:23 +00:00
parent b137e49318
commit 20833aaa0a
2 changed files with 8 additions and 2 deletions

View File

@ -519,7 +519,10 @@ int Editor::LinesOnScreen() {
PRectangle rcClient = GetClientRectangle();
int htClient = rcClient.bottom - rcClient.top;
//Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1);
return htClient / vs.lineHeight;
int n = htClient / vs.lineHeight;
if (n < 0)
n = 0;
return n;
}
int Editor::LinesToScroll() {

View File

@ -519,7 +519,10 @@ int Editor::LinesOnScreen() {
PRectangle rcClient = GetClientRectangle();
int htClient = rcClient.bottom - rcClient.top;
//Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1);
return htClient / vs.lineHeight;
int n = htClient / vs.lineHeight;
if (n < 0)
n = 0;
return n;
}
int Editor::LinesToScroll() {