Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Caret Drawing Artifacts #348

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Sources/SwiftTerm/Apple/CaretView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -61,5 +63,6 @@ extension CaretView {
}
CTFontDrawGlyphs(runFont, runGlyphs, &positions, positions.count, context)
}
context.restoreGState()
}
}
1 change: 1 addition & 0 deletions Sources/SwiftTerm/Mac/MacCaretView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CaretView: NSView, CALayerDelegate {

public var caretColor: NSColor = NSColor.selectedControlColor {
didSet {
bgColor = caretColor.cgColor
updateView()
}
}
Expand Down
Loading