From 8ca3d3bc75e8fa1b851cbaeaef128575fd8af0af Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Tue, 29 Aug 2023 13:06:06 +0200 Subject: [PATCH] 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. --- src/gtk/textctrl.cpp | 18 +++++++++++++----- src/msw/textctrl.cpp | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 7c26308a14..41e5279bd3 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -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; diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 6f15bb6284..c46f40cf91 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -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