Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#269 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi Config::separator_pos và process_half_line trong đường dẫn đầu ra side-by-side để xem dấu đánh dấu gutter được phát ra ở đâu và cột hai bắt đầu từ đâu. Tái hiện vấn đề bằng diff -y --width=40 và các tổ hợp width/tab-size được mô tả, sau đó thêm coverage hồi quy cho thấy dấu đánh dấu được căn giữa tại separator_pos khi gutter rộng hơn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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               <$
Ngôn ngữ chính
Rust
Star
276
Fork
39
Merge trung bình
4 ngày 12 giờ
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/diffutils

Tất cả issue của uutils/diffutils

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.