Skip to content

Commit 1e68aa6

Browse files
Merge pull request #300 from anthonyrisinger/truecolor
Match escape sequences wide enough to hold bold, truecolor fg, and truecolor bg.
2 parents 73b0995 + f2e5dff commit 1e68aa6

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

diff-so-fancy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ my $use_unicode_dash_for_ruler = git_config_boolean("diff-so-fancy.useUnicodeRul
2525
my $git_strip_prefix = git_config_boolean("diff.noprefix","false");
2626
my $has_stdin = has_stdin();
2727

28-
my $ansi_color_regex = qr/(\e\[([0-9]{1,3}(;[0-9]{1,3}){0,6})[mK])?/;
28+
my $ansi_color_regex = qr/(\e\[([0-9]{1,3}(;[0-9]{1,3}){0,10})[mK])?/;
2929
my $reset_color = color("reset");
3030
my $bold = color("bold");
3131
my $meta_color = "";

test/diff-so-fancy.bats

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ output=$( load_fixture "ls-function" | $diff_so_fancy )
2424
refute_line --index 22 --regexp "- eval \"env CLICOLOR"
2525
}
2626

27+
@test "+/- line symbols are stripped (truecolor)" {
28+
output=$( load_fixture "truecolor" | $diff_so_fancy )
29+
refute_output --partial "
30+
-"
31+
refute_output --partial "
32+
+"
33+
}
34+
2735
@test "empty lines added/removed are marked" {
2836
run printf "%s" "$output"
2937

test/fixtures/truecolor.diff

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git package.json package.json
2+
index 97965ab..f3ce90a 100644
3+
--- package.json
4+
+++ package.json
5+
@@ -13,8 +13,8 @@
6+
"url": "git+https://github.com/so-fancy/diff-so-fancy.git"
7+
},
8+
"keywords": [
9+
- "git",
10+
"diff",
11+
+ "git",
12+
"fancy",
13+
"good-lookin'",
14+
"diff-highlight",

0 commit comments

Comments
 (0)