Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed line number painting (#247) #1558

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/features/line_numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn linenumbers_and_styles<'a>(
let ((minus_number, plus_number), (minus_style, plus_style)) = match state {
State::HunkMinus(_, _) => {
line_numbers_data.line_number[Left] += increment as usize;
((Some(nr_left), None), (minus_style, plus_style))
((Some(nr_left), None), (minus_style, minus_style))
}
State::HunkMinusWrapped => ((None, None), (minus_style, plus_style)),
State::HunkZero(_, _) => {
Expand All @@ -90,7 +90,7 @@ pub fn linenumbers_and_styles<'a>(
State::HunkZeroWrapped => ((None, None), (zero_style, zero_style)),
State::HunkPlus(_, _) => {
line_numbers_data.line_number[Right] += increment as usize;
((None, Some(nr_right)), (minus_style, plus_style))
((None, Some(nr_right)), (plus_style, plus_style))
}
State::HunkPlusWrapped => ((None, None), (minus_style, plus_style)),
_ => return None,
Expand Down
8 changes: 4 additions & 4 deletions src/features/side_by_side.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ pub mod tests {
.explain_ansi()
.with_input(TWO_PLUS_LINES_DIFF)
.expect_after_header(r#"
(blue)│(88) (blue)│(normal) (blue)│(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal 22) (normal)
(blue)│(88) (blue)│(normal) (blue)│(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal 22) (normal)"#);
(blue)│(28) (blue)│(normal) (blue)│(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal 22) (normal)
(blue)│(28) (blue)│(normal) (blue)│(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal 22) (normal)"#);

DeltaTest::with_args(&[
"--side-by-side",
Expand All @@ -663,8 +663,8 @@ pub mod tests {
.explain_ansi()
.with_input(TWO_PLUS_LINES_DIFF)
.expect_after_header(r#"
(blue)│(88) (blue)│(normal) (blue) │(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal)
(blue)│(88) (blue)│(normal) (blue) │(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal)"#);
(blue)│(28) (blue)│(normal) (blue) │(28) 1 (blue)│(231 22)a (203)=(231) (141)1(normal)
(blue)│(28) (blue)│(normal) (blue) │(28) 2 (blue)│(231 22)b (203)=(231) (141)234567(normal)"#);
}

#[test]
Expand Down
Loading