From: Robert Roebling Date: Sun, 14 Jul 2002 17:08:19 +0000 (+0000) Subject: Corrected display for empty lines in text control. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b8c140b89f5e01564b79c0a779b0b4aba2542351 Corrected display for empty lines in text control. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index c31530e181..ac2dc2e4d0 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?"; void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y) { + long width, height ; + + if (paragraph.Length() == 0) + { + // empty line + dc.GetTextExtent( "H", &width, &height ); + y += height; + + return; + } + int x = 0 ; int i = 0 ; - long width, height ; bool linedrawn = true; while( paragraph.Length() > 0 ) { @@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc ) while (i < text.Length()) { - if (text[i] == 13 || text[i] == 10) - { - DrawParagraph(dc, paragraph,y); - paragraph = "" ; - } - else - { + if (text[i] == 13 || text[i] == 10) + { + DrawParagraph(dc, paragraph,y); + paragraph = "" ; + } + else + { paragraph += text[i]; } ++i; } if (paragraph.Length() > 0) - DrawParagraph(dc, paragraph,y); + DrawParagraph(dc, paragraph,y); } void wxStaticText::OnPaint( wxPaintEvent &event ) diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index c31530e181..ac2dc2e4d0 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -63,10 +63,20 @@ const wxString punct = " ,.-;:!?"; void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y) { + long width, height ; + + if (paragraph.Length() == 0) + { + // empty line + dc.GetTextExtent( "H", &width, &height ); + y += height; + + return; + } + int x = 0 ; int i = 0 ; - long width, height ; bool linedrawn = true; while( paragraph.Length() > 0 ) { @@ -153,19 +163,19 @@ void wxStaticText::OnDraw( wxDC &dc ) while (i < text.Length()) { - if (text[i] == 13 || text[i] == 10) - { - DrawParagraph(dc, paragraph,y); - paragraph = "" ; - } - else - { + if (text[i] == 13 || text[i] == 10) + { + DrawParagraph(dc, paragraph,y); + paragraph = "" ; + } + else + { paragraph += text[i]; } ++i; } if (paragraph.Length() > 0) - DrawParagraph(dc, paragraph,y); + DrawParagraph(dc, paragraph,y); } void wxStaticText::OnPaint( wxPaintEvent &event )