Cursor Disappearing with Multiple NSTextViews

I have a Mac app, Notenik, written with AppKit, that dynamically generates an Edit view that is used to edit multiple fields for a Note. Sometimes, depending on a user's request, multiple NSTextViews end up appearing within the same parent view (a tab, if that matters). Lately I and some of my users have noticed that, when moving from one NSTextView to another (either by tabbing or by clicking), the cursor initially fails to appear. Once the user starts editing within the NSTextView, the cursor appears and acts normally. And this doesn't occur when moving from an ordinary text field to an NSTextView -- only when moving from one NSTextView to another. But it is troubling and confusing to users that the cursor initially disappears. I'm not sure exactly when this started happening, but it has not been happening for very long. Although I make frequent updates to the app, this section of code has had no recent changes, so I am at a loss to explain this behavior, or to correct it. Any help would be appreciated.

Replies

I've noticed this bug as well in my app.

During my investigation, I tried creating a test project that simply had two NSTextViews side-by-side and it exhibits the bug. When the test app launches, the first text view has the IP flashing, but if I click on the other text view to start editing there, it disappears. As soon as I start typing, the IP shows up. It's incredibly frustrating as it does make it seem like you're not able to type, but you can.

For context, I've created the two NSTextViews programmatically by first calling NSTextView.scrollableTextView() to return an NSScrollView and then casting its documentView as an NSTextView. I don't know when this bug started showing up either. I'm running 13.4.1 (c).