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
This commit is contained in:
Vadim Zeitlin 2002-04-25 18:12:53 +00:00
parent 4e1c35f810
commit 41b2e0e6db
2 changed files with 8 additions and 24 deletions

View File

@ -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();
// 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);
}
else // no style
{
gint len = GET_EDITABLE_POS(m_text);
gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len );
}
// Bring editable's cursor back uptodate.
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));

View File

@ -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();
// 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);
}
else // no style
{
gint len = GET_EDITABLE_POS(m_text);
gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len );
}
// Bring editable's cursor back uptodate.
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));