diff: Fix word-diff style leaking to end of line

a0375398cc1e998d417df6d4ad8fc06952acc53b
Alexis Sellier committed ago 1 parent a7290fb3
crates/diff/src/viewer.rs +5 -1
1556 1556
        source_style: Style,
1557 1557
    ) -> Line {
1558 1558
        let inner = source_cols.saturating_add(LINE_NUMBER_WIDTH * 2 + MARKER_WIDTH);
1559 1559
1560 1560
        Line::truncate(&mut source, source_cols, "…");
1561 -
        Line::pad(&mut source, source_cols);
1561 +
        let source_width = source.width();
1562 +
        if source_width < source_cols {
1563 +
            let padding = " ".repeat(source_cols - source_width);
1564 +
            source.push(Label::new(&padding));
1565 +
        }
1562 1566
1563 1567
        let source = source.style(source_style);
1564 1568
        let mut line = Line::blank()
1565 1569
            .extend(cells[0].clone())
1566 1570
            .extend(cells[1].clone())
a.rs +0 -0
a.rs +0 -0
b.rs +0 -0
a.rs +0 -0
a.rs +0 -0
a.rs +0 -0
b.rs +0 -0
src/a.rs +0 -0
src/b.rs +0 -0
README.md +0 -0
src/app/a.rs +0 -0
src/lib/b.rs +0 -0
README.md +0 -0
assets/css/style.css +0 -0
assets/css/style.css +0 -0
a.rs +0 -0
a.rs +0 -0
a.rs +0 -0
b.rs +0 -0