问题
This should be a Bug, because I can reproduce it with my friends.
I just set allowsNonContiguous Layout of NSTextView. layoutManager to true, and that's the problem.
In the editor, I first enter N blank lines, that is, press N times to return. Then go back to the second line of our input, and press any key at the moment insertion Point disappears, which will make my insertion Point incorrect.
Here is my demo: https://github.com/iiiDD/TextViewDemo
回答1:
I had the same problem. I’ve detailed how I’ve fixed this bug here : NSTextView cursor doesn't appear when typing text on macOS 10.14
来源:https://stackoverflow.com/questions/57523797/nstextviews-insertion-point-draws-position-exceptions