diff --git a/Sources/SwiftTerm/Apple/CaretView.swift b/Sources/SwiftTerm/Apple/CaretView.swift index 9df3a15..578e66e 100644 --- a/Sources/SwiftTerm/Apple/CaretView.swift +++ b/Sources/SwiftTerm/Apple/CaretView.swift @@ -16,12 +16,14 @@ extension CaretView { guard let terminal else { return } + context.saveGState() + context.clip(to: [bounds]) context.setFillColor(TTColor.clear.cgColor) context.fill ([bounds]) if !hasFocus { context.setStrokeColor(bgColor) - context.setLineWidth(2) + context.setLineWidth(3) context.stroke(bounds) return } @@ -61,5 +63,6 @@ extension CaretView { } CTFontDrawGlyphs(runFont, runGlyphs, &positions, positions.count, context) } + context.restoreGState() } } diff --git a/Sources/SwiftTerm/Mac/MacCaretView.swift b/Sources/SwiftTerm/Mac/MacCaretView.swift index f2442ec..4d37cce 100644 --- a/Sources/SwiftTerm/Mac/MacCaretView.swift +++ b/Sources/SwiftTerm/Mac/MacCaretView.swift @@ -85,6 +85,7 @@ class CaretView: NSView, CALayerDelegate { public var caretColor: NSColor = NSColor.selectedControlColor { didSet { + bgColor = caretColor.cgColor updateView() } }