Post

Replies

Boosts

Views

Activity

Reply to NSTextView.shouldDrawInsertionPoint doesn't work with TextKit 2
I was mistaken, I do not use my own layout manager. I do, however, install my own NSLayoutManagerDelegate and NSTextStorage. IIUC, that also opts a program out of TextKit 2: class ViewController: NSViewController, NSTextViewDelegate, NSLayoutManagerDelegate { typealias Storage = ExpandedRopeTextStorage *snip snip* override public func viewWillAppear() { textView.layoutManager!.allowsNonContiguousLayout = true textView.layoutManager!.replaceTextStorage(storage) if textView.textStorage is Storage { Swift.print("storage properly replaced") } textView.wantsLayer = true textView.layoutManager!.delegate = self *snip snip* BTW, I just tried my program on macOS Ventura. My custom cursor replaces the AppKit default cursor in every instance on Ventura. Looks like AppKit may have broken between Ventura and Sonoma.
Topic: UI Frameworks SubTopic: AppKit Tags:
3w
Reply to NSTextView.shouldDrawInsertionPoint doesn't work with TextKit 2
What is the status of this issue? I do not think I am using TextKit 2. I install my own layout manager, and it's my understanding that that disables TextKit 2. Nevertheless, overriding shouldDrawInsertionPoint so that it returns false does not consistently disable insertion-point drawing in my custom NSTextView. My custom NSTextView used to work: the default insertion point was never shown. That was precisely what I expected and needed. BTW, if I add a Swift.print statement to my shouldDrawInsertionPoint override, I see that my override is evaluated whenever my selectedRanges willSet handler is called. However, when my setSelectedRanges override (which calls the super implementation, always) is called, shouldDrawInsertionPoint usually is not evaluated. I am using macOS Sonoma, BTW.
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’25
Reply to Can NSTextView work with custom NSTextContentManager implementation? (TextKit2)
I am trying to provide my own NSTextLocation subclass and I encounter a similar problem: an unrecognized selector range is sent to an NSTextRange instance that I create. It seems like it may be necessary to subclass every class in the cluster NSTextContentManager <-> NSTextLayoutManager <-> NSTextLocation to produce something that works. Can Apple provide any guidance?
Topic: UI Frameworks SubTopic: AppKit Tags:
Feb ’22