Fix wxTextCtrl proof checking functions return values

Return true, not false, from EnableProofCheck() when turning the checks
off in wxMSW.

Also fix wxTextProofOptions::IsSpellCheckEnabled() return value in
wxGTK, where EnableProofCheck() already returned the correct value but
only due to a combination of two bugs.

Closes #23831, #23832.
This commit is contained in:
Martin Corino 2023-08-29 13:06:06 +02:00 committed by Vadim Zeitlin
parent a64004970c
commit 8ca3d3bc75
2 changed files with 14 additions and 6 deletions

View file

@ -1054,7 +1054,7 @@ bool wxTextCtrl::EnableProofCheck(const wxTextProofOptions& options)
gspell_entry_set_inline_spell_checking(spell, options.IsSpellCheckEnabled());
}
return GetProofCheckOptions().IsSpellCheckEnabled();
return GetProofCheckOptions().IsSpellCheckEnabled() == options.IsSpellCheckEnabled();
}
wxTextProofOptions wxTextCtrl::GetProofCheckOptions() const
@ -1065,16 +1065,24 @@ wxTextProofOptions wxTextCtrl::GetProofCheckOptions() const
{
GtkTextView *textview = GTK_TEXT_VIEW(m_text);
if ( textview && gspell_text_view_get_from_gtk_text_view(textview) )
opts.SpellCheck();
if ( textview )
{
GspellTextView *spell = gspell_text_view_get_from_gtk_text_view (textview);
if ( spell && gspell_text_view_get_inline_spell_checking(spell) )
opts.SpellCheck();
}
}
else
{
GtkEntry *entry = GTK_ENTRY(m_text);
if ( entry && gspell_entry_get_from_gtk_entry(entry) )
opts.SpellCheck();
if ( entry )
{
GspellEntry *spell = gspell_entry_get_from_gtk_entry(entry);
if ( spell && gspell_entry_get_inline_spell_checking(spell) )
opts.SpellCheck();
}
}
return opts;

View file

@ -878,7 +878,7 @@ bool wxTextCtrl::EnableProofCheck(const wxTextProofOptions& options)
::SendMessage(GetHwnd(), EM_SETLANGOPTIONS, 0, langOptions);
return GetProofCheckOptions().IsSpellCheckEnabled();
return GetProofCheckOptions().IsSpellCheckEnabled() == options.IsSpellCheckEnabled();
}
wxTextProofOptions wxTextCtrl::GetProofCheckOptions() const