diff --git a/src/util/unified-diff.c b/src/util/unified-diff.c index 007275e6..ba0cb66f 100644 --- a/src/util/unified-diff.c +++ b/src/util/unified-diff.c @@ -222,6 +222,8 @@ escaped_display_text (const char *text) const char * xd_diff_line_background (XdDiffLineKind kind) { + if (kind == XD_DIFF_LINE_FILE) + return "#000000"; if (kind == XD_DIFF_LINE_ADDED) return "#183522"; if (kind == XD_DIFF_LINE_REMOVED) @@ -288,7 +290,7 @@ append_file_markup (MarkupBuilder *builder, start_markup_row (builder, line->kind); g_string_append_printf ( builder->text, - "%s" + "%s" " +%u" " −%u", path, additions, deletions); diff --git a/tests/test-unified-diff.c b/tests/test-unified-diff.c index 279eb870..986bdcee 100644 --- a/tests/test-unified-diff.c +++ b/tests/test-unified-diff.c @@ -97,6 +97,8 @@ test_formats_one_safe_layout (void) g_assert_nonnull (strstr (plain, "src/a.c +1 −1")); g_assert_nonnull (strstr (plain, "old ")); g_assert_nonnull (strstr (plain, "Showing first 3 of 5 rows")); + g_assert_nonnull (strstr ( + markup, "foreground=\"#ffbe6f\" weight=\"bold\">src/a.c")); g_assert_nonnull (strstr (markup, "foreground=\"#f66151\"")); } @@ -157,6 +159,7 @@ test_reports_row_kinds_without_backgrounds (void) /* An added line with no text of its own still colours its whole row. */ g_assert_cmpint (g_array_index (kinds, guint8, 5), ==, XD_DIFF_LINE_ADDED); + g_assert_cmpstr (xd_diff_line_background (XD_DIFF_LINE_FILE), ==, "#000000"); g_assert_cmpstr (xd_diff_line_background (XD_DIFF_LINE_ADDED), ==, "#183522"); g_assert_cmpstr (xd_diff_line_background (XD_DIFF_LINE_REMOVED), ==, "#3a1d1b"); g_assert_null (xd_diff_line_background (XD_DIFF_LINE_CONTEXT));