From d5d363321cae26b21d8dba2c70a161db2704c9d1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Apr 2007 21:19:59 +0000 Subject: [PATCH] don't return the next line text from GetLineText() for empty lines (patch 1697208) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/gtk/textctrl.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 33af0034d8..6d2489c8d2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -111,6 +111,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 diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 558d9064e5..f17fa1ff1a 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1119,8 +1119,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); }