]> git.saurik.com Git - wxWidgets.git/commitdiff
don't return the next line text from GetLineText() for empty lines (patch 1697208)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Apr 2007 21:17:09 +0000 (21:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Apr 2007 21:17:09 +0000 (21:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/gtk/textctrl.cpp

index 74b77b8c3ee099633ab9d2d101715201cc1018bb..e212d89871edbd7a6372e2cdf2ed24a4b548b3b0 100644 (file)
@@ -153,6 +153,7 @@ wxGTK:
 
 - Fix infinite loop when adding a wxStaticText control to a toolbar
 - Fix wxNO_BORDER style for wxRadioBox (David Hart)
+- Fix wxTextCtrl::GetLineText() for empty lines (Marcin Wojdyr)
 
 
 2.8.3
index 90d8220629eaa4b53cf7f05a92dba6a7a967049a..1a1985f8053c0bf03d7c652663b6d69f0aaea56f 100644 (file)
@@ -1139,8 +1139,12 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
     {
         GtkTextIter line;
         gtk_text_buffer_get_iter_at_line(m_buffer,&line,lineNo);
+
         GtkTextIter end = line;
-        gtk_text_iter_forward_to_line_end(&end);
+        // avoid skipping to the next line end if this one is empty
+        if ( !gtk_text_iter_ends_line(&line) )
+            gtk_text_iter_forward_to_line_end(&end);
+
         wxGtkString text(gtk_text_buffer_get_text(m_buffer, &line, &end, true));
         result = wxGTK_CONV_BACK(text);
     }