From 068b505d5e34478e6d41a2d58d8c1a0ed7001a88 Mon Sep 17 00:00:00 2001
From: DeWitt Clinton <dclinton@gmail.com>
Date: Sun, 25 May 2025 10:26:51 -0700
Subject: Reduce excessive diff separators in CLI. (#535)

Increases the threshold for rendering diff separators in the CLI's diff display. Previously, a separator was shown for gaps of more than one context line, leading to excessive separators in diffs with many small changes close together (Issue #534).

By increasing `MAX_CONTEXT_LINES_WITHOUT_GAP` to 5, we allow for more context lines before a separator is added, significantly reducing visual clutter in such diffs.

Added a test case to `DiffRenderer.test.tsx` to verify that separators are not rendered for small gaps within the new threshold.
---
 packages/cli/src/ui/components/messages/DiffRenderer.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'packages/cli/src/ui/components/messages/DiffRenderer.tsx')

diff --git a/packages/cli/src/ui/components/messages/DiffRenderer.tsx b/packages/cli/src/ui/components/messages/DiffRenderer.tsx
index bf00537d..8780d9c2 100644
--- a/packages/cli/src/ui/components/messages/DiffRenderer.tsx
+++ b/packages/cli/src/ui/components/messages/DiffRenderer.tsx
@@ -188,7 +188,7 @@ const renderDiffContent = (
     : `diff-box-${crypto.createHash('sha1').update(JSON.stringify(parsedLines)).digest('hex')}`;
 
   let lastLineNumber: number | null = null;
-  const MAX_CONTEXT_LINES_WITHOUT_GAP = 1;
+  const MAX_CONTEXT_LINES_WITHOUT_GAP = 5;
 
   return (
     <Box flexDirection="column" key={key}>
-- 
cgit v1.2.3

