Skip to content

Commit 6b2c945

Browse files
Bump CETV, Revert Trailing Padding (#272) (#292)
1 parent f51ed8e commit 6b2c945

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

Example/CodeEditSourceEditorExample/CodeEditSourceEditorExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
// A fast, efficient, text view for code.
1818
.package(
1919
url: "https://github.com/CodeEditApp/CodeEditTextView.git",
20-
from: "0.7.7"
20+
from: "0.7.9"
2121
),
2222
// tree-sitter languages
2323
.package(

Sources/CodeEditSourceEditor/Controller/TextViewController+StyleViews.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import AppKit
9+
import CodeEditTextView
910

1011
extension TextViewController {
1112
package func generateParagraphStyle() -> NSMutableParagraphStyle {

Sources/CodeEditSourceEditor/Controller/TextViewController.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ public class TextViewController: NSViewController {
9393
didSet {
9494
textView.layoutManager.wrapLines = wrapLines
9595
scrollView.hasHorizontalScroller = !wrapLines
96-
textView.edgeInsets = HorizontalEdgeInsets(
97-
left: textView.edgeInsets.left,
98-
right: textViewTrailingInset // Refresh this value, see docs
99-
)
96+
textView.textInsets = textViewInsets
10097
}
10198
}
10299

@@ -200,7 +197,16 @@ public class TextViewController: NSViewController {
200197

201198
/// The trailing inset for the editor. Grows when line wrapping is disabled.
202199
package var textViewTrailingInset: CGFloat {
203-
wrapLines ? 1 : 48
200+
// See https://github.com/CodeEditApp/CodeEditTextView/issues/66
201+
// wrapLines ? 1 : 48
202+
0
203+
}
204+
205+
package var textViewInsets: HorizontalEdgeInsets {
206+
HorizontalEdgeInsets(
207+
left: gutterView.gutterWidth,
208+
right: textViewTrailingInset
209+
)
204210
}
205211

206212
// MARK: Init
@@ -329,6 +335,6 @@ public class TextViewController: NSViewController {
329335
extension TextViewController: GutterViewDelegate {
330336
public func gutterViewWidthDidUpdate(newWidth: CGFloat) {
331337
gutterView?.frame.size.width = newWidth
332-
textView?.edgeInsets = HorizontalEdgeInsets(left: newWidth, right: textViewTrailingInset)
338+
textView?.textInsets = textViewInsets
333339
}
334340
}

0 commit comments

Comments
 (0)