NSLayoutManager setAllowsNonContiguousLayout moves the caret

With setAllowsNonContiguousLayoutset the value to YES, if I follow these steps, I get strange behavior:

  • Select all text in NSTextView
  • Hit backspace to remove all text
  • Enter a few lines of text
  • Trying to use backspace to delete text again

In step 4, the cursor moves to the line above and at a random random point on the line, but the actual glyphs are removed from the correct location.

The disjoint layout is a bit experimental / buggy, how is it? If I disable this, everything will work as expected.

I will write a bug report with Apple, but has anyone else seen this behavior and worked around it?

+3
source share
1 answer

Error reporting is the right way, I think. From what I heard, the consistent layout caused a lot of headaches for some developers, which made them abandon this feature again from their application. Funnily enough, it looks like a hell of a lot of work ... even for Apple.

+2
source

Source: https://habr.com/ru/post/1772466/


All Articles