Skip to content

fix(render): badge every structural move and collapse nested move spans - #165

Merged
HarshK97 merged 1 commit into
mainfrom
fix/move-badge-destinations
Sep 19, 2026
Merged

HarshK97 merged 1 commit into
mainfrom
fix/move-badge-destinations

Conversation

@HarshK97

Copy link
Copy Markdown
Owner

Problem

  1. When code moved, Diffmantic painted it teal, but it often didn't show where it went. Intra-hunk moves skipped badges if they were within 10 lines of each other, leaving you with teal text and no destination line number.
  2. When an entire block moved, we were emitting move spans for the parent container and every single nested child token inside it. That generated redundant overlapping spans in the UI output and cluttered the render pass.
  3. Move badges were styled in dim italic overlay grey, making them hard to spot against terminal backgrounds.

What Changed

  • Added nestedMoveActions in internal/serialize/spans.go to keep only the outermost move span on each side. Child moves contained inside a larger moved block are skipped, so relocated code gets one clean span instead of token soup.
  • Updated internal/sidebyside/render.go and internal/inline/render.go to badge declarations, blocks, and multiline moves across the board. We now only skip badges for single-line shifts that stay within the same hunk, where destination lines are already visible on screen.
  • Dropped the , modified suffix check from move badges to keep annotations short and direct.
  • Switched move badge styling from dim overlay grey to move teal (color.MoveFg) across both side-by-side and inline renderers, so destination hints visually match the moved code.
  • Added unit test coverage for nested move filtering in internal/serialize/spans_test.go and refreshed affected UI golden fixtures.

Move destinations were unreadable: most teal spans carried no L-number,
nested fragments painted tag soup, and badges hid in dim grey.

- serialize: emit highlight spans only for outermost moves
- sbs/inline: badge decl/block/multiline moves in any hunk, single-line
  shifts only across hunks
- sbs/inline: render badges in move-teal instead of dim overlay
- goldens: 9 expected_ui fixtures regenerated (span reductions only)
@HarshK97
HarshK97 merged commit e6b4efb into main Sep 19, 2026
17 checks passed
@HarshK97
HarshK97 deleted the fix/move-badge-destinations branch September 19, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant