diff: `-y` draws the gutter marker at the wrong column unless the gutter is 3 or 4 columns wide
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Rust
- Estrellas
- 276
- Forks
- 39
- Merge medio
- 3 h 27 min
- PR fusionados (30 d)
- 3
Descripción
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 <$
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza siguiendo Config::separator_pos y process_half_line en la ruta de salida lado a lado para ver dónde se emite el marcador del gutter y dónde comienza la columna dos. Reproduce el problema con diff -y --width=40 y las combinaciones de ancho y tamaño de tabulación descritas, y después añade cobertura de regresión que muestre que el marcador está centrado en separator_pos para gutters más anchos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 68/100