electron/patches/chromium/fix_win32_synchronous_spellcheck.patch
trop[bot] 8e32d80512
fix: re-enable synchronous spellcheck on Windows (#45763)
* fix: re-enable synchronous spellcheck on Windows

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* revert: fix: empty suggestions with windows platform checker

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-02-21 20:46:13 -06:00

29 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Keeley Hammond <khammond@slack-corp.com>
Date: Wed, 19 Feb 2025 11:18:44 -0800
Subject: fix: re-enable synchronous spellcheck on Windows
This fix partially reverts 6109477: Code Health:
Clean up stale base::Feature "WinRetrieveSuggestionsOnlyOnDemand"
https://chromium-review.googlesource.com/c/chromium/src/+/6109477
by re-adding a synchronous call to FillSuggestionList.
This patch can be removed when an asynchronous spellcheck API
option is added to Electron.
diff --git a/components/spellcheck/browser/windows_spell_checker.cc b/components/spellcheck/browser/windows_spell_checker.cc
index f5a7411037758427eddc088b5426554b4a500d33..04b3edd4d8c58d38e260cc54beb0dab86368fc25 100644
--- a/components/spellcheck/browser/windows_spell_checker.cc
+++ b/components/spellcheck/browser/windows_spell_checker.cc
@@ -239,6 +239,11 @@ std::vector<SpellCheckResult> BackgroundHelper::RequestTextCheckForAllLanguages(
(action == CORRECTIVE_ACTION_GET_SUGGESTIONS ||
action == CORRECTIVE_ACTION_REPLACE)) {
std::vector<std::u16string> suggestions;
+ // TODO (vertedinde): Perform the synchronous operation of retrieving
+ // suggestions for all misspelled words while performing a text check.
+ FillSuggestionList(it->first,
+ text.substr(start_index, error_length),
+ &suggestions);
result_map[std::tuple<ULONG, ULONG>(start_index, error_length)]
.push_back(suggestions);
}