Compare commits

...
Author SHA1 Message Date
Cursor Agent 4136680b77 Fix dead code and overscan filter in T3ReviewDiffView
- Remove unused status pill methods (fileStatusText, drawStatusPill,
  drawCenteredText) and related style fields (fileHeaderStatusFont*) that
  were defined but never called from any drawing method.

- Fix overscan range being negated by inner visibility filter: the skip
  condition in draw(_:) now uses rangeMinY/rangeMaxY (overscan-expanded
  bounds) instead of visibleMinY/visibleMaxY, so pre-rendered rows in the
  overscan region are actually drawn to reduce flicker during fast scroll.
2026-05-03 05:47:06 +00:00
4 changed files with 1 additions and 50 deletions

No files matched your search

@@ -160,8 +160,6 @@ private struct ReviewDiffNativeStylePayload: Decodable {
let fileHeaderMetaFontWeight: String?
let fileHeaderSubtextFontSize: Double?
let fileHeaderSubtextFontWeight: String?
let fileHeaderStatusFontSize: Double?
let fileHeaderStatusFontWeight: String?
let emptyStateFontSize: Double?
let emptyStateFontWeight: String?
}
@@ -193,8 +191,6 @@ private struct ReviewDiffNativeStyle {
let fileHeaderMetaFontWeight: UIFont.Weight
let fileHeaderSubtextFontSize: CGFloat
let fileHeaderSubtextFontWeight: UIFont.Weight
let fileHeaderStatusFontSize: CGFloat
let fileHeaderStatusFontWeight: UIFont.Weight
let emptyStateFontSize: CGFloat
let emptyStateFontWeight: UIFont.Weight
@@ -226,8 +222,6 @@ private struct ReviewDiffNativeStyle {
fileHeaderMetaFontWeight: fontWeight(payload?.fileHeaderMetaFontWeight, fallback: .bold),
fileHeaderSubtextFontSize: metric(payload?.fileHeaderSubtextFontSize, fallback: 11),
fileHeaderSubtextFontWeight: fontWeight(payload?.fileHeaderSubtextFontWeight, fallback: .medium),
fileHeaderStatusFontSize: metric(payload?.fileHeaderStatusFontSize, fallback: 10),
fileHeaderStatusFontWeight: fontWeight(payload?.fileHeaderStatusFontWeight, fallback: .semibold),
emptyStateFontSize: metric(payload?.emptyStateFontSize, fallback: 13),
emptyStateFontWeight: fontWeight(payload?.emptyStateFontWeight, fallback: .semibold)
)
@@ -293,8 +287,6 @@ private struct ReviewDiffNativeStyle {
fileHeaderMetaFontWeight: fileHeaderMetaFontWeight,
fileHeaderSubtextFontSize: fileHeaderSubtextFontSize,
fileHeaderSubtextFontWeight: fileHeaderSubtextFontWeight,
fileHeaderStatusFontSize: fileHeaderStatusFontSize,
fileHeaderStatusFontWeight: fileHeaderStatusFontWeight,
emptyStateFontSize: emptyStateFontSize,
emptyStateFontWeight: emptyStateFontWeight
)
@@ -849,10 +841,6 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
UIFont.systemFont(ofSize: style.fileHeaderSubtextFontSize, weight: style.fileHeaderSubtextFontWeight)
}
private var fileHeaderStatusFont: UIFont {
UIFont.systemFont(ofSize: style.fileHeaderStatusFontSize, weight: style.fileHeaderStatusFontWeight)
}
private var emptyStateFont: UIFont {
UIFont.systemFont(ofSize: style.emptyStateFontSize, weight: style.emptyStateFontWeight)
}
@@ -1356,7 +1344,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
continue
}
let rowEnd = rowStart + rowHeight
if rowEnd < visibleMinY || rowStart > visibleMaxY {
if rowEnd < rangeMinY || rowStart > rangeMaxY {
continue
}
drawRow(rows[rowIndex], rowIndex: rowIndex, context: context)
@@ -1569,19 +1557,6 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
)
}
private func fileStatusText(_ changeType: String?) -> String {
switch changeType {
case "new":
return "A"
case "deleted":
return "D"
case "renamed":
return "R"
default:
return ""
}
}
private func fileStatusColor(_ changeType: String?) -> UIColor {
switch changeType {
case "new":
@@ -1595,13 +1570,6 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
}
}
private func drawStatusPill(_ text: String, rect: CGRect, color: UIColor, font: UIFont) {
let path = UIBezierPath(roundedRect: rect, cornerRadius: rect.height / 2)
color.withAlphaComponent(0.12).setFill()
path.fill()
drawCenteredText(text, rect: rect, color: color, font: font)
}
private func drawFileIcon(rect: CGRect, changeType: String?) {
let color = fileStatusColor(changeType)
let outerPath = UIBezierPath(roundedRect: rect, cornerRadius: 6)
@@ -1721,17 +1689,6 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate {
context.restoreGState()
}
private func drawCenteredText(_ text: String, rect: CGRect, color: UIColor, font: UIFont) {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center
let attributes: [NSAttributedString.Key: Any] = [
.font: font,
.foregroundColor: color,
.paragraphStyle: paragraphStyle,
]
(text as NSString).draw(in: rect, withAttributes: attributes)
}
private func drawHunkRow(_ row: ReviewDiffNativeRow, rect: CGRect, context: CGContext) {
let fileId = resolvedFileId(for: row)
let horizontalOffset = horizontalOffset(for: fileId)
@@ -61,8 +61,6 @@ const NATIVE_DEBUG_STYLE = {
fileHeaderMetaFontWeight: "semibold",
fileHeaderSubtextFontSize: 11,
fileHeaderSubtextFontWeight: "medium",
fileHeaderStatusFontSize: 9,
fileHeaderStatusFontWeight: "bold",
emptyStateFontSize: 12,
emptyStateFontWeight: "medium",
} satisfies NativeReviewDiffStyle;
@@ -87,8 +87,6 @@ export interface NativeReviewDiffStyle {
readonly fileHeaderMetaFontWeight?: string;
readonly fileHeaderSubtextFontSize?: number;
readonly fileHeaderSubtextFontWeight?: string;
readonly fileHeaderStatusFontSize?: number;
readonly fileHeaderStatusFontWeight?: string;
readonly emptyStateFontSize?: number;
readonly emptyStateFontWeight?: string;
}
@@ -48,8 +48,6 @@ export const NATIVE_REVIEW_DIFF_STYLE = {
fileHeaderMetaFontWeight: "semibold",
fileHeaderSubtextFontSize: 11,
fileHeaderSubtextFontWeight: "medium",
fileHeaderStatusFontSize: 9,
fileHeaderStatusFontWeight: "bold",
emptyStateFontSize: 12,
emptyStateFontWeight: "medium",
} as const;