Skip to content

Diff view marks padding rows with "-" and indents hunks with two-digit line numbers one column further #491

Closed

Description

@matt-edmondson

What's wrong

In the side-by-side diff (Compare File), the padding rows that line one side up with a longer hunk on the other side carry a - marker, as if a line had been deleted there. Each block has its own fixed-fit table, so a hunk whose line numbers reach two digits gets a wider number column and its text sits one column further right than its neighbours.

  • Expected: a padding row shows no marker (no line was removed on that side), and hunks keep their text in the same column.
  • Actual: ShowDiffLines(Enumerable.Repeat(string.Empty, extraLines), -1, "-", ...) at ProjectDirector/ProjectDirector.cs:1930 (left, under a green filler colour) and :2001 (right) writes - on every padding row. BeginTable($"DiffBlockLeft{i}", 3, ImGuiTableFlags.SizingFixedFit) (:1889, :1960) sizes the number column per hunk, which is why hunk 3 of the gallery's comparing-a-file.png (lines 5-10 on the right) is indented one column more than hunks 1 and 2.

Seen in docs/gallery/comparing-a-file.png: hunk 2 on the left has two - rows tinted green under Alpha's single deleted line.

Suggested fix

Pass an empty prefix for filler rows, and give the number column a fixed width (for example from the larger file's line count) so every hunk lines up.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions