Skip to content

Commit

Permalink
[Unified Text Replacement] Replacing text with different text lengths…
Browse files Browse the repository at this point in the history
… sometimes results in duplicate characters

https://bugs.webkit.org/show_bug.cgi?id=271137
rdar://124474722

Reviewed by Aditya Keerthi.

Use the correct resolved simple range as it was intended.

* Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm:
(WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveReplacements):

Canonical link: https://commits.webkit.org/276281@main
  • Loading branch information
rr-codes committed Mar 18, 2024
1 parent 6f67017 commit db6af52
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static void replaceContentsInRange(WebCore::LocalFrame& frame, const WebCore::Si
auto newResolvedRange = resolveCharacterRange(*sessionRange, newRangeWithOffset);

auto markerData = WebCore::DocumentMarker::UnifiedTextReplacementData { replacementData.originalString.string, replacementData.uuid, WebCore::DocumentMarker::UnifiedTextReplacementData::State::Pending };
addMarker(resolvedRange, WebCore::DocumentMarker::Type::UnifiedTextReplacement, markerData);
addMarker(newResolvedRange, WebCore::DocumentMarker::Type::UnifiedTextReplacement, markerData);

additionalOffset += replacementData.replacement.length() - replacementData.originalRange.length;
}
Expand Down

0 comments on commit db6af52

Please sign in to comment.