Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

diff: `-y` draws the gutter marker at the wrong column unless the gutter is 3 or 4 columns wide

Offen
#269 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
rust
Bereich
cli

Rechercherichtung

Beginne damit, Config::separator_pos und process_half_line im Side-by-Side-Ausgabepfad nachzuverfolgen, um zu sehen, wo die Gutter-Markierung ausgegeben wird und wo Spalte zwei beginnt. Reproduziere das Problem mit diff -y --width=40 und den beschriebenen Kombinationen aus Breite und Tabulatorgröße und füge anschließend eine Regressionstestabdeckung hinzu, die zeigt, dass die Markierung bei breiteren Guttern an separator_pos zentriert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

In side-by-side output, Config::separator_pos holds the middle of the gutter, but the gutter marker is not written there. It goes wherever process_half_line stopped padding the left half line, which is one column past sdiff_half_width. separator_pos is only read afterwards, to pad from the marker to the start of column two.

For a gutter g columns wide, separator_pos is sdiff_half_width + (g - 1) / 2. The two positions agree only when g is 3 or 4. The default --width=130 --tabsize=8 produces a gutter of exactly 3, which is why the default output looks correct, but any width or tab size where the tab alignment pushes column two further past the balance point drifts. --width=130 --tabsize=4 is off by one, --width=200 --tabsize=8 by two, --width=130 --tabsize=128 by 61.

printf 'aa\n' > f1; : > f2
diff -y --width=40 f1 f2 | expand | cat -A
aa                 <$
diffutils diff -y --width=40 f1 f2 | expand | cat -A
aa               <$
Vorherrschende Sprache
Rust
Sterne
276
Forks
39
Ø Merge
4 T. 12 Std.
Gemergte PRs (30 T.)
3

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus uutils/diffutils

Alle Issues in uutils/diffutils

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.