Skip to content

Commit 00bcea1

Browse files
committed
Update Positions On Layout, Linting Fixes
1 parent d6fd1eb commit 00bcea1

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// TextViewController+GutterViewDelegate.swift
3+
// CodeEditSourceEditor
4+
//
5+
// Created by Khan Winter on 4/17/25.
6+
//
7+
8+
import Foundation
9+
10+
extension TextViewController: GutterViewDelegate {
11+
public func gutterViewWidthDidUpdate(newWidth: CGFloat) {
12+
gutterView?.frame.size.width = newWidth
13+
textView?.textInsets = textViewInsets
14+
}
15+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// TextViewController+ReloadUI.swift
3+
// CodeEditSourceEditor
4+
//
5+
// Created by Khan Winter on 4/17/25.
6+
//
7+
8+
import AppKit
9+
10+
extension TextViewController [
11+
func reloadUI() {
12+
textView.isEditable = isEditable
13+
textView.isSelectable = isSelectable
14+
15+
styleScrollView()
16+
styleTextView()
17+
styleGutterView()
18+
19+
highlighter?.invalidate()
20+
minimapView.updateContentViewHeight()
21+
minimapView.updateDocumentVisibleViewPosition()
22+
}
23+
]

Sources/CodeEditSourceEditor/Controller/TextViewController.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -328,21 +328,6 @@ public class TextViewController: NSViewController {
328328
/// A default `NSParagraphStyle` with a set `lineHeight`
329329
package lazy var paragraphStyle: NSMutableParagraphStyle = generateParagraphStyle()
330330

331-
// MARK: - Reload UI
332-
333-
func reloadUI() {
334-
textView.isEditable = isEditable
335-
textView.isSelectable = isSelectable
336-
337-
styleScrollView()
338-
styleTextView()
339-
styleGutterView()
340-
341-
highlighter?.invalidate()
342-
minimapView.updateContentViewHeight()
343-
minimapView.updateDocumentVisibleViewPosition()
344-
}
345-
346331
deinit {
347332
if let highlighter {
348333
textView.removeStorageDelegate(highlighter)
@@ -361,10 +346,3 @@ public class TextViewController: NSViewController {
361346
localEvenMonitor = nil
362347
}
363348
}
364-
365-
extension TextViewController: GutterViewDelegate {
366-
public func gutterViewWidthDidUpdate(newWidth: CGFloat) {
367-
gutterView?.frame.size.width = newWidth
368-
textView?.textInsets = textViewInsets
369-
}
370-
}

Sources/CodeEditSourceEditor/Minimap/MinimapView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ public class MinimapView: FlippedNSView {
246246
override public func layout() {
247247
layoutManager?.layoutLines()
248248
super.layout()
249+
updateContentViewHeight()
250+
updateDocumentVisibleViewPosition()
249251
}
250252

251253
override public func hitTest(_ point: NSPoint) -> NSView? {

0 commit comments

Comments
 (0)