How to use SPACE instead of TAB in NSTextView

I just know how to change tab width in NSTextView

NSMutableParagraphStyle *paragraphStyle = [[self defaultParagraphStyle] mutableCopy]; [paragraphStyle setTabStops:[NSArray array]]; [paragraphStyle setDefaultTabInterval: tabWidth]; 

But is there a way to use 4 SPACES instead of TAB in an NSTextView?

+6
source share
1 answer

Well, it's late, but I will send my answer in case some other poor soul struggles with this.

I have been struggling with this all day and finally found the answer to cocoabuilder

So what I did, in my text view delegate:

 - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)commandSelector { if (commandSelector == @selector(insertTab:)) { [aTextView insertText:@" "]; return YES; } return NO; } 

Everything seems to be fine.

Cancel also works.

+7
source

Source: https://habr.com/ru/post/909379/


All Articles