File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Sources/CodeEditSourceEditor Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ let package = Package(
17
17
// A fast, efficient, text view for code.
18
18
. package (
19
19
url: " https://github.com/CodeEditApp/CodeEditTextView.git " ,
20
- from: " 0.10.1 "
20
+ from: " 0.11.0 "
21
21
) ,
22
22
// tree-sitter languages
23
23
. package (
Original file line number Diff line number Diff line change @@ -106,9 +106,7 @@ extension TextViewController {
106
106
object: scrollView. contentView,
107
107
queue: . main
108
108
) { [ weak self] notification in
109
- guard let clipView = notification. object as? NSClipView ,
110
- let textView = self ? . textView else { return }
111
- textView. updatedViewport ( self ? . scrollView. documentVisibleRect ?? . zero)
109
+ guard let clipView = notification. object as? NSClipView else { return }
112
110
self ? . gutterView. needsDisplay = true
113
111
self ? . minimapXConstraint? . constant = clipView. bounds. origin. x
114
112
}
@@ -120,7 +118,6 @@ extension TextViewController {
120
118
object: scrollView. contentView,
121
119
queue: . main
122
120
) { [ weak self] _ in
123
- self ? . textView. updatedViewport ( self ? . scrollView. documentVisibleRect ?? . zero)
124
121
self ? . gutterView. needsDisplay = true
125
122
self ? . emphasisManager? . removeEmphases ( for: EmphasisGroup . brackets)
126
123
self ? . updateTextInsets ( )
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ final class MinimapLineRenderer: TextLayoutManagerRenderDelegate {
21
21
range: NSRange ,
22
22
stringRef: NSTextStorage ,
23
23
markedRanges: MarkedRanges ? ,
24
- breakStrategy : LineBreakStrategy
24
+ lineBreakStrategy : LineBreakStrategy
25
25
) {
26
26
let maxWidth : CGFloat = if let textView, textView. wrapLines {
27
27
textView. layoutManager. maxLineLayoutWidth
@@ -34,7 +34,7 @@ final class MinimapLineRenderer: TextLayoutManagerRenderDelegate {
34
34
range: range,
35
35
stringRef: stringRef,
36
36
markedRanges: markedRanges,
37
- breakStrategy : breakStrategy
37
+ attachments : [ ]
38
38
)
39
39
40
40
// Make all fragments 2px tall
@@ -62,6 +62,12 @@ final class MinimapLineRenderer: TextLayoutManagerRenderDelegate {
62
62
63
63
func characterXPosition( in lineFragment: LineFragment , for offset: Int ) -> CGFloat {
64
64
// Offset is relative to the whole line, the CTLine is too.
65
- return 8 + ( CGFloat ( offset - CTLineGetStringRange( lineFragment. ctLine) . location) * 1.5 )
65
+ guard let content = lineFragment. contents. first else { return 0.0 }
66
+ switch content. data {
67
+ case . text( let ctLine) :
68
+ return 8 + ( CGFloat ( offset - CTLineGetStringRange( ctLine) . location) * 1.5 )
69
+ case . attachment:
70
+ return 0.0
71
+ }
66
72
}
67
73
}
You can’t perform that action at this time.
0 commit comments