From 5c5c0a7c6ec51bea347bb2636270422af279b037 Mon Sep 17 00:00:00 2001 From: Khan Winter <35942988+thecoolwinter@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:18:28 -0500 Subject: [PATCH 1/2] Add tab stops --- .../CodeEditTextView/Controller/STTextViewController.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/CodeEditTextView/Controller/STTextViewController.swift b/Sources/CodeEditTextView/Controller/STTextViewController.swift index 2132b4055..977f86584 100644 --- a/Sources/CodeEditTextView/Controller/STTextViewController.swift +++ b/Sources/CodeEditTextView/Controller/STTextViewController.swift @@ -233,10 +233,8 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt let paragraph = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle paragraph.minimumLineHeight = lineHeight paragraph.maximumLineHeight = lineHeight - // TODO: Fix Tab widths - // This adds tab stops throughout the document instead of only changing the width of tab characters -// paragraph.tabStops = [NSTextTab(type: .decimalTabStopType, location: 0.0)] -// paragraph.defaultTabInterval = CGFloat(tabWidth) * (" " as NSString).size(withAttributes: [.font: font]).width + paragraph.tabStops = [NSTextTab(type: .decimalTabStopType, location: 0.0)] + paragraph.defaultTabInterval = CGFloat(tabWidth) * (" " as NSString).size(withAttributes: [.font: font]).width return paragraph } From 5793a8412a48c65a319d5a255edcee0c4fc79266 Mon Sep 17 00:00:00 2001 From: Khan Winter <35942988+thecoolwinter@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:26:06 -0500 Subject: [PATCH 2/2] Remove default tab stop --- Sources/CodeEditTextView/Controller/STTextViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/CodeEditTextView/Controller/STTextViewController.swift b/Sources/CodeEditTextView/Controller/STTextViewController.swift index 977f86584..cdc540a5c 100644 --- a/Sources/CodeEditTextView/Controller/STTextViewController.swift +++ b/Sources/CodeEditTextView/Controller/STTextViewController.swift @@ -233,7 +233,7 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt let paragraph = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle paragraph.minimumLineHeight = lineHeight paragraph.maximumLineHeight = lineHeight - paragraph.tabStops = [NSTextTab(type: .decimalTabStopType, location: 0.0)] + paragraph.tabStops.removeAll() paragraph.defaultTabInterval = CGFloat(tabWidth) * (" " as NSString).size(withAttributes: [.font: font]).width return paragraph }