Re: NSTextView tab stop count

2016-10-15 Thread tridiak
Ok. Your code works. I think the reason I couldn’t get it to work is when I was 
using [textView insertText:mas], causing my settings to be overridden.
Thanks for help.

> On 15/10/2016, at 12:22 PM, Shane Stanley  wrote:
> 
> On 15 Oct. 2016, at 12:43 am, tridiak  wrote:
>> 
>> This works up to 12. Above that, it sticks to 12.
> 
> Are you sure you're just not seeing them because the text in some columns is 
> longer than you tab width? 
> 
> I just made a simple example with this:
> 
>NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] 
> initWithString:@"\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\t27\t28\t29\t30"];
>NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
>NSMutableArray* ma=[NSMutableArray array];
>for (int t=0; t< 31; t++) {
>[ma addObject:[[NSTextTab alloc] initWithType:NSLeftTabStopType 
> location:t*28.0f]];
>}
>[style setTabStops:ma];
>[mas addAttribute:NSParagraphStyleAttributeName value:style 
> range:NSMakeRange(0,mas.length)];
>[self.textView insertText:mas];
> 
> It works as expected.
> 
> -- 
> Shane Stanley 
> , 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/tridiak%40ihug.co.nz
> 
> This email sent to trid...@ihug.co.nz


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTextView tab stop count

2016-10-14 Thread Shane Stanley
On 15 Oct. 2016, at 12:43 am, tridiak  wrote:
> 
> This works up to 12. Above that, it sticks to 12.

Are you sure you're just not seeing them because the text in some columns is 
longer than you tab width? 

I just made a simple example with this:

NSMutableAttributedString *mas = [[NSMutableAttributedString alloc] 
initWithString:@"\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\t27\t28\t29\t30"];
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
NSMutableArray* ma=[NSMutableArray array];
for (int t=0; t< 31; t++) {
[ma addObject:[[NSTextTab alloc] initWithType:NSLeftTabStopType 
location:t*28.0f]];
}
[style setTabStops:ma];
[mas addAttribute:NSParagraphStyleAttributeName value:style 
range:NSMakeRange(0,mas.length)];
[self.textView insertText:mas];

It works as expected.

-- 
Shane Stanley 
, 



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTextView tab stop count

2016-10-14 Thread Jens Alfke

> On Oct 14, 2016, at 6:43 AM, tridiak  wrote:
> 
> How does Xcode & Text Wrangler pull it off?

Xcode pretty heavily customizes the Cocoa text engine; even back in the 
ProjectBuilder days they had a bunch of custom editing subclasses. I wouldn’t 
be surprised if they implement their own tabbing for efficiency, since 
obviously the docs it works with include a bazillion tab stops.

Text Wrangler doesn’t use Cocoa’s text system at all. It’s a variant of BBEdit, 
which has been around since the early ‘90s so it must have its own text engine.

I’m surprised that there would be some arbitrary limit like 12 tab stops on a 
line. That sounds like something to file a bug report about. All they need is 
to change “kMaxTabStopsPerLine” to a bigger number like 100, right? :-p

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com