I have a Mac app with an embedded rich-text NSTextView, but the same problem can be reproduced with TextEdit:
- When a line contains only an image and no text, typing right after the image causes the text below to move downwards.
- Open a new TextEdit document and type "test", [return]
- Cmd-Shift-Ctrl-4to capture a screenshot of something
- Paste the image on the next line
- [return], type "test"
- Now type something after the image
To debug this in my app I added some code to highlight each line fragment rect via NSLayoutManager:
The height of line 2 starts out at 14pt, as soon as I type a letter, it changes to 18pt.
Is this a bug in TextKit or a problem with incorrect/missing NSAttributedString attributes in my code?
I tried setting a paragraph style and font for my inline image, as well as a default paragraph style for the NSTextView, but the problem still occurs.

