0

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.

enter image description here enter image description here

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

Simon
  • 438
  • 4
  • 14
  • Haven't I seen this question before? Which keyboard and which language and keyboard layout (System Prefs) do you use? Any keyboard related helper apps? – Willeke Aug 16 '19 at 12:25
  • What is the insertion point, the blinking red line or the I-beam cursor? What happens if you do what you say in the question, "set allowsNonContiguousLayout of NSTextView.layoutManager to true", without the subclass of `NSTextView`? – Willeke Aug 16 '19 at 12:37
  • I think you mean the I-beam. The hiding of the I-beam is intentional and has nothing to do with the jumping insertion point. I think the insertion point jumps up when the characters are converted to another character if a different (Chinese?) keyboard layout were used. Which combination of Language, Region, Input Source and other settings causes the jumping insertion point? Did you try Language English, Region United States, Input Source U.S. International - PC, No spell checking, text replacements, smart quotes and dashes and no `NSTextView` subclass? – Willeke Aug 17 '19 at 09:47
  • We're all keyboarding in the United States, and we have the same problem. – Simon Aug 18 '19 at 00:50

1 Answers1

-2

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

bpisano
  • 335
  • 3
  • 13
  • Maybe not the same problem. Because my problem is that when insertion Point is hidden, entering new text will appear. – Simon Aug 16 '19 at 11:59
  • 1
    Can you please give more details : What macOS version are you running ? Your code seems to work properly on macOS Mojave. Did your tried to call updateInsertionPointStateAndRestartTimer(true) on your TextView's TextStorage ? – bpisano Aug 16 '19 at 12:15
  • I also run on 10.14. My friends and I are both versions of 10.14. I've tried the updateInsertionPointStateAndRestart Timer method. Of course, it can correct the position, but there will still be flashing pictures. If you can't reproduce it, maybe there is a deviation in the operation. – Simon Aug 16 '19 at 12:22
  • It's worth noting that you have to press the keyboard at the second line and the moment the cursor disappears to reproduce it. PS: My English is really poor. – Simon Aug 16 '19 at 12:25
  • Please don't post links to answers, instead mark the question as duplicate. – Willeke Aug 17 '19 at 09:08
  • @Willeke I don't think you know the problem at all. The two problems are different. And his plan I tried, and did not solve the problem. – Simon Aug 18 '19 at 00:51