Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 20ad46e49071fe79d8fbfbb0816756e507224172
      
https://github.com/WebKit/WebKit/commit/20ad46e49071fe79d8fbfbb0816756e507224172
  Author: Megan Gardner <[email protected]>
  Date:   2026-10-02 (Fri, 02 Oct 2026)

  Changed paths:
    M Source/WebCore/editing/WritingToolsCompositionCommand.cpp
    M Source/WebCore/page/writing-tools/WritingToolsController.h
    M Source/WebCore/page/writing-tools/WritingToolsController.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Proofread Undo/Redo in Mail only undoes one word.
https://bugs.webkit.org/show_bug.cgi?id=325982
rdar://184300251

Reviewed by Abrar Rahman Protyasha and Wenson Hsieh.

Each proofreading suggestion was applied as its own edit command, so each word 
was a separate undo step.
Apply all the suggestions in a batch through a single 
WritingToolsCompositionCommand so that one undo reverts them all.

WritingToolsCompositionCommand only supported one replacement per command, 
because it measured each replacement
against the context range from before the command started. Measure against the 
current context range instead.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm

* Source/WebCore/editing/WritingToolsCompositionCommand.cpp:
(WebCore::WritingToolsCompositionCommand::replaceContentsOfRangeWithFragment):
* Source/WebCore/page/writing-tools/WritingToolsController.h:
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::proofreadingSessionDidReceiveSuggestions):
(WebCore::WritingToolsController::replaceContentsOfRangeInSession):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm:
(TEST(WritingTools, ProofreadingUndoRevertsEverySuggestionInBatch)):

Canonical link: https://commits.webkit.org/322527@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to