Skip to content

fix(conflict): draw complete block boundaries in merge gutters - #556

Merged
yanuoma merged 1 commit into
mainfrom
refactor/issue-404-gutter
Sep 10, 2026
Merged

fix(conflict): draw complete block boundaries in merge gutters#556
yanuoma merged 1 commit into
mainfrom
refactor/issue-404-gutter

Conversation

@yanuoma

@yanuoma yanuoma commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #404 by drawing the complete extent of each conflict block, including alignment filler rows, instead of showing indistinguishable signs on individual changed lines.

Each buffer projection is expanded into ordered visual positions and receives a complete marker map before rendering: no positions produce no marker, a single position produces [, and multiple positions produce ╭─, , and ╰─. The same rule applies to filler-only projections.

Changes

  • Group conflict gutter responsibilities under ui/conflict/gutter/: a pure calculator, a coordinator, and native signcolumn/statuscolumn backends.
  • Compute original, modified, and Result projections independently; use tracked extmarks for Result coordinates.
  • Render filler markers in the drawing window's context rather than the focused window, and bind cached markers to the displayed buffer.
  • Correct BOF coordinate translation when fillers occur both before and after the first line, including partially or entirely off-screen leading fillers.
  • Preserve native number/relative-number alignment, fold columns, wrapped rows, and signcolumn configurations. Leave custom statuscolumns alone and never overwrite another owner's replacement during teardown.
  • Release marker caches, signs, and Result refresh callbacks when retargeting or closing a conflict view, including invalid suspended sessions.
  • Restore the conflict-specific input geometry after a tab round trip without resetting Result content or its tracked resolution state.

Regression coverage

Add a repository-owned embedded-Neovim screen-grid harness using bundled MessagePack and libuv, without external test dependencies. The new specs are automatically discovered by the regular test runner.

63 new regression cases:

  • 29 block/grid cases: 19 hand-authored base shapes, BOF/EOF, empty and filler-only projections, partial scrolling, blank surrounding rows, multiple blocks, Result projections, column compatibility, and highlight updates. Check both glyph cells and colors in all three panes under each focus state.
  • 18 window-option cases: native number modes, folds, wrapping, other signs, per-window context, custom statuscolumns, repeated attachment, and ownership-safe restoration.
  • 16 lifecycle cases: real Git merge fixtures, conflict/ordinary/untracked/deleted file transitions, window recreation, tab changes, resizing, accept/undo/redo/discard, manual Result edits, stale callbacks, and invalid-session cleanup.

Block fixtures enter through the production conflict renderer. Their expected screen rows neither call nor duplicate the marker calculator. Window-option tests compare unchanged columns against Neovim's native rendering.

Benefits and scope

Conflict boundaries remain visible through filler rows and independently of pane focus. File/window transitions no longer leak conflict markers or overwrite unrelated column settings.

Merge algorithms, filler placement/count rules, highlight definitions, and scroll-sync code are unchanged. A structural comparison against the main baseline matched all 628 blocks, filler metadata, and the contents of all three buffers exactly.

Custom statuscolumn providers are preserved, not composed with this renderer; the new filler rendering applies to columns owned by CodeDiff.

Testing

  • CODEDIFF_TEST_JOBS=8 ./tests/run_tests.sh109 spec files passed, including all 63 new cases.
  • ctest --test-dir build --output-on-failure10/10 C tests passed.
  • make build.
  • StyLua checks for all changed Lua files.
  • git diff --check.
  • Structural comparison of the 628-block stress fixture against main.
  • Temporary mutation checks against the unchanged repository grid specs: restoring the single-filler glyph regression causes 3 failures; restoring focused-window lookup causes 18 failures.

Local validation used Neovim 0.13.0-dev-1310+gfaf8345eef. The installed Neovim 0.11.4 binary could not start because its old tree-sitter dynamic library is missing, so this does not claim a completed local 0.11.4 run.

@yanuoma
yanuoma requested a review from esmuellert as a code owner September 10, 2026 02:07
@yanuoma
yanuoma enabled auto-merge September 10, 2026 02:07
@yanuoma
yanuoma merged commit a4d85ea into main Sep 10, 2026
20 checks passed
@yanuoma
yanuoma deleted the refactor/issue-404-gutter branch September 10, 2026 02:11
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.

Unable to clearly visualise conflicts

2 participants