Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ios/input/EnrichedMarkdownTextInput.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,10 @@ - (void)handleTextChanged

[self applyFormatting];

NSUInteger clampedEditLocation = MIN(editLocation, newLength);
NSUInteger clampedInsertedLength = MIN(insertedLength, newLength - clampedEditLocation);
[_detectorPipeline processTextChange:ENRMGetPlainText(_textView)
modificationRange:NSMakeRange(editLocation, insertedLength)];
modificationRange:NSMakeRange(clampedEditLocation, clampedInsertedLength)];

[self updatePlaceholderVisibility];
[self emitOnChangeText];
Expand Down Expand Up @@ -1184,14 +1186,16 @@ - (void)textViewDidEndEditing:(UITextView *)textView

- (void)textViewDidChangeSelection:(UITextView *)textView
{
NSRange newSelection = textView.selectedRange;
NSRange previousSelection = _lastSelectedRange;
_lastSelectedRange = newSelection;

if (_isApplyingFormatting || _isTextChanging) {
return;
}

NSRange newSelection = textView.selectedRange;
BOOL selectionMoved =
newSelection.location != _lastSelectedRange.location || newSelection.length != _lastSelectedRange.length;
_lastSelectedRange = newSelection;
newSelection.location != previousSelection.location || newSelection.length != previousSelection.length;

if (selectionMoved) {
[_pendingStyles removeAllObjects];
Expand Down Expand Up @@ -1263,10 +1267,11 @@ - (void)textInputDidChange

- (void)textInputDidChangeSelection
{
_lastSelectedRange = _textView.selectedRange;

if (_isApplyingFormatting || _isTextChanging) {
return;
}
_lastSelectedRange = _textView.selectedRange;

[_pendingStyles removeAllObjects];
[_pendingStyleRemovals removeAllObjects];
Expand Down
Loading