Smart Dash replacements fail if text is selected

Originator:maxlanger
Number:rdar://45038024 Date Originated:October 5 2018, 12:12 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:
Classification: Reproducible:Always
 
Area:
UIKit

Summary:
iOS 11 introduced smart dashes. They follow certain rules to when to replace dashes with en/em dashes. However, the replacements fail if text, that lies after a dash, is selected. 

Steps to Reproduce:
1. Open Notes on iOS or use any other default UITextView with smart punctuation / dashes enabled.
2. Type 2- (2<dash>)
3. Type a word, select the word
4. Type another dash with the word selected
5. The word is correctly replaced with an en dash, however the dash after the 2 is still present. This dash should be removed as well.

The same applies for other replacements, where one or two dashes get replaced with an em dash.

Expected Results:
"2-[word]" should become "2–" (2<en dash>).

Actual Results:
"2-[word]" becomes "2-–" (2<dash><en dash>).

Version/Build:
iOS 11.4.1, iOS 12.0 (16A366)

Configuration:
Standard UITextView, Smart Punctuation enabled.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!