mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
cli: add label for line numbers in --color-words
diff
If you want to set a background color on added/removed lines, you currently get the same style on the line numbers. This patch lets you specify a different style by overriding it on the line numbers.
This commit is contained in:
parent
60b35f676e
commit
5ba6078354
1 changed files with 14 additions and 10 deletions
|
@ -375,21 +375,25 @@ fn show_color_words_diff_line(
|
|||
diff_line: &DiffLine,
|
||||
) -> io::Result<()> {
|
||||
if diff_line.has_left_content {
|
||||
write!(
|
||||
formatter.labeled("removed"),
|
||||
"{:>4}",
|
||||
diff_line.left_line_number
|
||||
)?;
|
||||
formatter.with_label("removed", |formatter| {
|
||||
write!(
|
||||
formatter.labeled("line_number"),
|
||||
"{:>4}",
|
||||
diff_line.left_line_number
|
||||
)
|
||||
})?;
|
||||
write!(formatter, " ")?;
|
||||
} else {
|
||||
write!(formatter, " ")?;
|
||||
}
|
||||
if diff_line.has_right_content {
|
||||
write!(
|
||||
formatter.labeled("added"),
|
||||
"{:>4}",
|
||||
diff_line.right_line_number
|
||||
)?;
|
||||
formatter.with_label("added", |formatter| {
|
||||
write!(
|
||||
formatter.labeled("line_number"),
|
||||
"{:>4}",
|
||||
diff_line.right_line_number
|
||||
)
|
||||
})?;
|
||||
write!(formatter, ": ")?;
|
||||
} else {
|
||||
write!(formatter, " : ")?;
|
||||
|
|
Loading…
Reference in a new issue