From d1c5d66bd349ab636a7ca1a341951a5f5cf23130 Mon Sep 17 00:00:00 2001 From: isaac <> Date: Sat, 2 May 2026 11:44:05 +0200 Subject: [PATCH] LinkHighlightingNode: fix X-edge snap unreachable after midY snap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In drawRectsImageContent's modern path the snap loop runs midY trimming first, leaving rects[i].maxY == rects[i+1].minY for adjacent line rects. The X-edge snap guard then evaluated rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i+1]) — but positive dy shrinks the rect, so after the trim the guarded rectangle no longer intersects its neighbor (CGRect.intersects requires positive-area overlap). Flip dy to -1.0 so the temp rect grows and touching neighbors satisfy the guard. Co-Authored-By: Claude Opus 4.7 (1M context) --- submodules/Display/Source/LinkHighlightingNode.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/Display/Source/LinkHighlightingNode.swift b/submodules/Display/Source/LinkHighlightingNode.swift index 99fa88c0a8..dd2f57f3ae 100644 --- a/submodules/Display/Source/LinkHighlightingNode.swift +++ b/submodules/Display/Source/LinkHighlightingNode.swift @@ -82,7 +82,7 @@ private func drawRectsImageContent(size: CGSize, context: CGContext, color: UICo rects[i + 1].size.height = rects[i + 1].maxY - midY hadChanges = true } - if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i + 1]) { + if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: -1.0).intersects(rects[i + 1]) { if abs(rects[i].minX - rects[i + 1].minX) < minRadius { let commonMinX = min(rects[i].origin.x, rects[i + 1].origin.x) if rects[i].origin.x != commonMinX {