From 41b2e0e6db70a6615e23cc1fc72e966275c9041b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Apr 2002 18:12:53 +0000 Subject: [PATCH] fixed bug with the text attr not being reset even after SetDefaultStyle(wxTextAttr()) call git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/textctrl.cpp | 16 ++++------------ src/gtk1/textctrl.cpp | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 84aca5d404..487926fefc 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -452,18 +452,10 @@ void wxTextCtrl::WriteText( const wxString &text ) // After cursor movements, gtk_text_get_point() is wrong by one. gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) ); - // if we have any special style, use it - if ( !m_defaultStyle.IsDefault() ) - { - GetInsertionPoint(); - - wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); - } - else // no style - { - gint len = GET_EDITABLE_POS(m_text); - gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len ); - } + // always use m_defaultStyle, even if it is empty as otherwise + // resetting the style and appending some more text wouldn't work: if + // we don't specify the style explicitly, the old style would be used + wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); // Bring editable's cursor back uptodate. SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 84aca5d404..487926fefc 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -452,18 +452,10 @@ void wxTextCtrl::WriteText( const wxString &text ) // After cursor movements, gtk_text_get_point() is wrong by one. gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) ); - // if we have any special style, use it - if ( !m_defaultStyle.IsDefault() ) - { - GetInsertionPoint(); - - wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); - } - else // no style - { - gint len = GET_EDITABLE_POS(m_text); - gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len ); - } + // always use m_defaultStyle, even if it is empty as otherwise + // resetting the style and appending some more text wouldn't work: if + // we don't specify the style explicitly, the old style would be used + wxGtkTextInsert(m_text, m_defaultStyle, txt, txtlen); // Bring editable's cursor back uptodate. SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); -- 2.45.2