From c68dea664de326088fc81e15180fe5140d20e5c3 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 2 Nov 2006 22:45:32 +0000 Subject: [PATCH] Undid completely wrong patch 1438117: other platforms do _not_ count the visible lines, only the underlying lines. With the patch, you can't reliably do anything with lines using the other functions. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/textctrl.cpp | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 7443a8f3c9..48dbbd95a2 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1153,31 +1153,7 @@ int wxTextCtrl::GetNumberOfLines() const { if ( IsMultiLine() ) { - GtkTextIter iter; - gtk_text_buffer_get_iter_at_offset( m_buffer, &iter, 0 ); - - // move forward by one display line until the end is reached - int lineCount = 1; - while ( gtk_text_view_forward_display_line(GTK_TEXT_VIEW(m_text), &iter) ) - { - lineCount++; - } - - // If the last character in the text buffer is a newline, - // gtk_text_view_forward_display_line() will return false without that - // line being counted. Must add one manually in that case. - GtkTextIter lastCharIter; - gtk_text_buffer_get_iter_at_offset - ( - m_buffer, - &lastCharIter, - gtk_text_buffer_get_char_count(m_buffer) - 1 - ); - gchar lastChar = gtk_text_iter_get_char( &lastCharIter ); - if ( lastChar == wxT('\n') ) - lineCount++; - - return lineCount; + return gtk_text_buffer_get_line_count( m_buffer ); } else // single line {