Skip to content

Add fill Emphasis Style Option #120

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

Merged
merged 1 commit into from
Jul 30, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ public final class EmphasisManager {
layer.fillColor = nil
layer.opacity = emphasis.flash ? 0.0 : 1.0
layer.zPosition = 1
case .outline(let color):
case let .outline(color, shouldFill):
layer.cornerRadius = 2.5
layer.borderColor = color.cgColor
layer.borderWidth = 0.5
layer.fillColor = nil
layer.fillColor = shouldFill ? color.cgColor : nil
layer.opacity = emphasis.flash ? 0.0 : 1.0
layer.zPosition = 1
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/CodeEditTextView/EmphasisManager/EmphasisStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ public enum EmphasisStyle: Equatable {
/// Underline emphasis with a line color
case underline(color: NSColor)
/// Outline emphasis with a border color
case outline(color: NSColor)
case outline(color: NSColor, fill: Bool = false)

public static func == (lhs: EmphasisStyle, rhs: EmphasisStyle) -> Bool {
switch (lhs, rhs) {
case (.standard, .standard):
return true
case (.underline(let lhsColor), .underline(let rhsColor)):
return lhsColor == rhsColor
case (.outline(let lhsColor), .outline(let rhsColor)):
return lhsColor == rhsColor
case let (.outline(lhsColor, lhsFill), .outline(rhsColor, rhsFill)):
return lhsColor == rhsColor && lhsFill == rhsFill
default:
return false
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/CodeEditTextView/TextView/TextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import TextStory
/// [`NSTextInputClient`](https://developer.apple.com/documentation/appkit/nstextinputclient) to work well with system
/// text interactions such as inserting text and marked text.
///
public class TextView: NSView, NSTextContent {
open class TextView: NSView, NSTextContent {
// MARK: - Statics

/// The default typing attributes:
Expand Down Expand Up @@ -356,7 +356,7 @@ public class TextView: NSView, NSTextContent {
setUpDragGesture()
}

required init?(coder: NSCoder) {
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down