diff --git a/Classes/Issues/Comments/CodeBlock/IssueCommentCodeBlockCell.swift b/Classes/Issues/Comments/CodeBlock/IssueCommentCodeBlockCell.swift
index 44f2823c..9fb2c627 100644
--- a/Classes/Issues/Comments/CodeBlock/IssueCommentCodeBlockCell.swift
+++ b/Classes/Issues/Comments/CodeBlock/IssueCommentCodeBlockCell.swift
@@ -24,7 +24,7 @@ final class IssueCommentCodeBlockCell: UICollectionViewCell, ListBindable, Colla
right: Styles.Sizes.gutter
)
- let label = UILabel()
+ let textView = AttributedStringView()
let scrollView = UIScrollView()
let overlay = CreateCollapsibleOverlay()
@@ -42,8 +42,7 @@ final class IssueCommentCodeBlockCell: UICollectionViewCell, ListBindable, Colla
scrollView.backgroundColor = Styles.Colors.Gray.lighter.color
contentView.addSubview(scrollView)
- label.numberOfLines = 0
- scrollView.addSubview(label)
+ scrollView.addSubview(textView)
}
required init?(coder aDecoder: NSCoder) {
@@ -72,9 +71,7 @@ final class IssueCommentCodeBlockCell: UICollectionViewCell, ListBindable, Colla
let contentSize = viewModel.contentSize
scrollView.contentSize = contentSize
- label.attributedText = viewModel.code.attributedText
- let textFrame = CGRect(x: 0, y: 0, width: contentSize.width, height: contentSize.height)
- label.frame = UIEdgeInsetsInsetRect(textFrame, IssueCommentCodeBlockCell.textViewInset)
+ textView.configureAndSizeToFit(text: viewModel.code, width: 0)
}
// MARK: CollapsibleCell
diff --git a/Classes/Issues/Comments/Markdown/MMElement+CodeBlock.swift b/Classes/Issues/Comments/Markdown/MMElement+CodeBlock.swift
index 775a14ec..b30c5f3f 100644
--- a/Classes/Issues/Comments/Markdown/MMElement+CodeBlock.swift
+++ b/Classes/Issues/Comments/Markdown/MMElement+CodeBlock.swift
@@ -31,7 +31,8 @@ extension MMElement {
let stringSizing = NSAttributedStringSizing(
containerWidth: 0,
attributedText: NSAttributedString(string: text, attributes: attributes),
- inset: inset
+ inset: inset,
+ backgroundColor: Styles.Colors.Gray.lighter.color
)
return IssueCommentCodeBlockModel(
code: stringSizing,
diff --git a/Classes/Systems/NSAttributedStringSizing.swift b/Classes/Systems/NSAttributedStringSizing.swift
index a095ca16..abc6faa4 100644
--- a/Classes/Systems/NSAttributedStringSizing.swift
+++ b/Classes/Systems/NSAttributedStringSizing.swift
@@ -36,11 +36,13 @@ final class NSAttributedStringSizing: NSObject, ListDiffable {
let inset: UIEdgeInsets
let attributedText: NSAttributedString
let screenScale: CGFloat
+ let backgroundColor: UIColor
init(
containerWidth: CGFloat,
attributedText: NSAttributedString,
inset: UIEdgeInsets = .zero,
+ backgroundColor: UIColor = .white,
exclusionPaths: [UIBezierPath] = [],
maximumNumberOfLines: Int = 0,
lineFragmentPadding: CGFloat = 0.0,
@@ -54,6 +56,7 @@ final class NSAttributedStringSizing: NSObject, ListDiffable {
self.attributedText = attributedText
self.inset = inset
self.screenScale = screenScale
+ self.backgroundColor = backgroundColor
textContainer = NSTextContainer()
textContainer.exclusionPaths = exclusionPaths
@@ -129,7 +132,7 @@ final class NSAttributedStringSizing: NSObject, ListDiffable {
let size = textSize(width)
UIGraphicsBeginImageContextWithOptions(size, true, screenScale)
- UIColor.white.setFill()
+ backgroundColor.setFill()
UIBezierPath(rect: CGRect(origin: .zero, size: size)).fill()
let glyphRange = layoutManager.glyphRange(for: textContainer)
layoutManager.drawBackground(forGlyphRange: glyphRange, at: .zero)
diff --git a/Resources/Info.plist b/Resources/Info.plist
index a361ce67..55eb10fd 100644
--- a/Resources/Info.plist
+++ b/Resources/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
1.0.0
CFBundleVersion
- 89
+ 92
LSApplicationQueriesSchemes
org-appextension-feature-password-management