Search Issue Tracker
By Design
Votes
1
Found in [Package]
2.0.1
Issue ID
1184177
Regression
No
[TMP] Text is overlapped when pasted text's line breaks are deleted
How to reproduce:
1. Open the attached '1184177-TMP-text-overlap.zip' project
2. Open 'SampleScene' scene
3. Select Text (TMP) GameObject in the Hierarchy
4. Copy and paste some text to the TMP Text field in the Inspector
5. Delete line-breaks
6. Observe the text field in the Scene View
Expected result: Pasted text is not overlapped
Actual result: Pasted text is overlapped
Reproducible with: 2017.4.32f1, 2018.4.9f1, 2019.2.7f1(TMP 1.4.0, 2.0.1), 2019.3.0b4 (TMP 1.4.0, 2.0.1), 2020.1.0a5 (TMP 1.4.0, 2.0.1)
Note: TMP for 2017.4, 2018.4 downloaded from Asset Store
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture is not applied on a Custom Render Texture when a Cubemap is selected as the texture
- 2D light leaks through ShadowCaster2D when ShadowCaster2D components are disabled then re enabled at runtime in Player builds
- Unity Hub redirects to The Unity Roadmap when navigating to “Send Feedback” option
- UI Toolkit throws warning and fails to clear references when fields are not typed as UnityEngine.Object
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
Resolution Note:
The reported behavior is by design.
The original text contained both Carriage Return (CR) (\r) and Line Feed (LF) (\n). Deleting the LF leaves the CR in the text and as such since Carriage Return's function is to return the carriage to the start position of the line, the text is overwritten. Carriage Return does not add a new line.
I realize that text containing control characters (which are not visible) makes it hard to understand / decipher these types of behavior. At some point I do plan to add a mode where these control characters will be visible in the Text Input Box which should help alleviate this type of confusion.