From f843358a0361d0e66daad90268e1a5350d1f0a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= Date: Mon, 6 Jul 2026 11:14:30 +0200 Subject: [PATCH 1/4] fix(iOS): removing chars during IME composition --- ios/EnrichedTextInputView.mm | 19 ++++++++++++------- ios/utils/ParagraphAttributesUtils.mm | 7 +++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 8795f0bbb..3a314ec05 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -1664,6 +1664,7 @@ - (void)handleWordModificationBasedChanges:(NSString *)word - (void)anyTextMayHaveBeenModified { // we don't do no text changes when working with iOS marked text if (textView.markedTextRange != nullptr) { + [self handlePlaceholderVisibility]; return; } @@ -1685,13 +1686,7 @@ - (void)anyTextMayHaveBeenModified { [mentionStyleClass manageMentionEditing]; } - // placholder management - if (!_placeholderLabel.hidden && textView.textStorage.string.length > 0) { - [self setPlaceholderLabelShown:NO]; - } else if (textView.textStorage.string.length == 0 && - _placeholderLabel.hidden) { - [self setPlaceholderLabelShown:YES]; - } + [self handlePlaceholderVisibility]; // modified words handling NSArray *currentDirtyRanges = [attributesManager getDirtyRanges]; @@ -1747,6 +1742,16 @@ - (void)anyTextMayHaveBeenModified { [self scheduleRelayoutIfNeeded]; } +- (void)handlePlaceholderVisibility { + // placholder management + if (!_placeholderLabel.hidden && textView.textStorage.string.length > 0) { + [self setPlaceholderLabelShown:NO]; + } else if (textView.textStorage.string.length == 0 && + _placeholderLabel.hidden) { + [self setPlaceholderLabelShown:YES]; + } +} + // Debounced relayout helper - coalesces multiple requests into one per runloop // tick - (void)scheduleRelayoutIfNeeded { diff --git a/ios/utils/ParagraphAttributesUtils.mm b/ios/utils/ParagraphAttributesUtils.mm index 517e5b349..5f6d05def 100644 --- a/ios/utils/ParagraphAttributesUtils.mm +++ b/ios/utils/ParagraphAttributesUtils.mm @@ -20,6 +20,13 @@ + (BOOL)handleBackspaceInRange:(NSRange)range return NO; } + // Do not manually intervene if the user is in the middle of IME + // composition. Let the iOS system handle the backspace natively to prevent + // state desync. + if (typedInput->textView.markedTextRange != nil) { + return NO; + } + // we make sure it was a backspace (text with 0 length) and it deleted // something (range longer than 0) if (text.length > 0 || range.length == 0) { From c97ab797d2655de8912b3b6a1c84d2030ead4187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= <74975508+kacperzolkiewski@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:35:42 +0200 Subject: [PATCH 2/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- ios/utils/ParagraphAttributesUtils.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/utils/ParagraphAttributesUtils.mm b/ios/utils/ParagraphAttributesUtils.mm index 5f6d05def..0a70351f9 100644 --- a/ios/utils/ParagraphAttributesUtils.mm +++ b/ios/utils/ParagraphAttributesUtils.mm @@ -23,7 +23,7 @@ + (BOOL)handleBackspaceInRange:(NSRange)range // Do not manually intervene if the user is in the middle of IME // composition. Let the iOS system handle the backspace natively to prevent // state desync. - if (typedInput->textView.markedTextRange != nil) { + if (typedInput->textView.markedTextRange != nullptr) { return NO; } From d67f466b41044ddea52a5de0e28a2b883d1d3b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= <74975508+kacperzolkiewski@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:35:52 +0200 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- ios/EnrichedTextInputView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 3a314ec05..6efc5ab57 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -1743,7 +1743,7 @@ - (void)anyTextMayHaveBeenModified { } - (void)handlePlaceholderVisibility { - // placholder management + // placeholder management if (!_placeholderLabel.hidden && textView.textStorage.string.length > 0) { [self setPlaceholderLabelShown:NO]; } else if (textView.textStorage.string.length == 0 && From fab855f9d932b53953c02f18003eb88e73d7c862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BB=C3=B3=C5=82kiewski?= <74975508+kacperzolkiewski@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:49:22 +0200 Subject: [PATCH 4/4] Update ios/EnrichedTextInputView.mm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mikołaj Szydłowski <9szydlowski9@gmail.com> --- ios/EnrichedTextInputView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/EnrichedTextInputView.mm b/ios/EnrichedTextInputView.mm index 6efc5ab57..94ce793be 100644 --- a/ios/EnrichedTextInputView.mm +++ b/ios/EnrichedTextInputView.mm @@ -1662,7 +1662,7 @@ - (void)handleWordModificationBasedChanges:(NSString *)word } - (void)anyTextMayHaveBeenModified { - // we don't do no text changes when working with iOS marked text + // we don't do text changes when working with iOS marked text if (textView.markedTextRange != nullptr) { [self handlePlaceholderVisibility]; return;