Reputation: 536
See screenshot from Sublime Text 2
The second line is wrapped with indent. Can I do this with standard TextView in OS X?
Upvotes: 2
Views: 201
Reputation: 6732
If you need visually indent wrapped lines (aka IDE editor) without modifying text storage attributes, then subclassing of NSATSTypesetter
is needed. See my SO answer.
Upvotes: 1
Reputation: 90601
According to Text System User Interface Layer Programming Guide: Setting Text Margins, you would set a mutable paragraph style object's firstLineHeadIndent
and headIndent
to do that. So:
NSMutableParagraphStyle* style = [NSMutableParagraphStyle defaultParagraphStyle];
style.headIndent = style.firstLineHeadIndent = 40;
[textView.textStorage addAttribute:style value:NSParagraphStyleAttributeName range:NSMakeRange(0, textView.textStorage.length)];
Upvotes: 1