Skip to content

Commit

Permalink
Adds default tab stops (#362)
Browse files Browse the repository at this point in the history
* Adds default tab stops

* Fixes SwiftLint warning
  • Loading branch information
simonbs committed Mar 16, 2024
1 parent c09a14f commit ed2f83f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/Runestone/Library/DefaultStringAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ struct DefaultStringAttributes {

func apply(to attributedString: NSMutableAttributedString) {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.tabStops = []
paragraphStyle.tabStops = (0 ..< 20).map { index in
NSTextTab(textAlignment: .natural, location: CGFloat(index) * tabWidth)
}
paragraphStyle.defaultTabInterval = tabWidth
let range = NSRange(location: 0, length: attributedString.length)
let attributes: [NSAttributedString.Key: Any] = [
Expand Down

0 comments on commit ed2f83f

Please sign in to comment.