Home > Net >  NSTextView – text disappears while adding a new line
NSTextView – text disappears while adding a new line

Time:08-03

I've recently met a problem that once I'm adding a new line in an NSTextView, the least visible line disappears for a moment. The same happens when I'm deleting a line.

The problem occurs even in a newly created Xcode project with pure NSTextView. Here is a quick preview (GIF):

Bug Preview

Here is the text I'm playing with (4 lines):



aa

Has anyone met this problem?

CodePudding user response:

The solutions is to set this allowsNonContiguousLayout of the LayoutManager to false, e.g.:

textView.layoutManager.allowsNonContiguousLayout = false

  • Related