electron/patches/chromium/fix_win32_synchronous_spell...

30 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 7b78720e8d25a3dee4821c816bd9629b1526e50a..be89b74fd85983e63c983aec0d10036ce1ca63df 100644
--- a/components/spellcheck/browser/windows_spell_checker.cc
+++ b/components/spellcheck/browser/windows_spell_checker.cc
@@ -240,6 +240,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);
}