At what level is selection handled in the Cocoa text system?
I noticed that if you hook up two NSTextViews to the same NSTextStorage object, you can select across the two and copy/und开发者_如何学运维o/etc. as if they were one. At what level is this all managed? Where should I get the combined selected range from?
Selection is managed in NSLayoutManager
. It seems, your two views connected to the same layout manager like on this picture.
If you use more then one layout manager with the text storage, you could get the combined selected range by combining the individual selectedRanges:
of all the NSTextView
s.
精彩评论