开发者

At what level is selection handled in the Cocoa text system?

开发者 https://www.devze.com 2023-03-30 07:06 出处:网络
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

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 NSTextViews.

0

精彩评论

暂无评论...
验证码 换一张
取 消