Conversation
gaoanze888
left a comment
There was a problem hiding this comment.
Reviewed exact head 9b97cd9 against current main. Extracting the shared leading whitespace before diffWords() preserves indentation on both removed and added lines without changing one-sided whitespace handling. The extraction occurs after tab normalization, and only the paired single-line intra-line branch changes; context, standalone additions/removals, ANSI-aware wrapping, and selection paths remain unchanged. The focused regression suite passes 3/3 locally and covers prefix insertion, indented replacement, and keeping shared indentation outside inverse highlighting. No blocker found.
|
@gaoanze888 thank you for your interest in helping with PRs and issues but posting AI agent based reviews is not helpful for us. |
Problem
The edit tool's intra-line renderer can drop indentation from a removed line when text is inserted before otherwise unchanged content.
For example, this input:
was rendered as:
diffWords()groups the shared leading spaces into the added segment (" const result = "). The existing highlighting logic moved those spaces outside inverse styling, but only appended them to the added line.Solution
Extract whitespace shared by both lines before calling
diffWords(), then initialize both rendered lines with that prefix. This preserves indentation without changing the existing word-level highlighting behavior. The existing handling for whitespace that belongs to only one side remains unchanged.Added regression coverage for:
Validation
npm run check./test.shpackages/coding-agent/test/diff.test.ts(3 tests)