Skip to content

Commit 3db8bcb

Browse files
Mark Pauleystevemao
authored andcommitted
Fixing horizontal rules not displaying correctly
- closes #72
1 parent 0cf6539 commit 3db8bcb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

diff-so-fancy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ else
2626
fi
2727

2828
CSI=$'\x1b\['
29+
NL="
30+
"
2931
color_code_regex="(${CSI}([0-9]{1,3}(;[0-9]{1,3}){0,3})[m|K])?"
3032
reset_color="${CSI}0?m"
3133
reset_escape="${CSI}m"
@@ -38,8 +40,8 @@ format_diff_header () {
3840
# simplify the unified patch diff header
3941
$SED -E "s/^($color_code_regex)diff --git .*$//g" \
4042
| $SED -E "/$git_index_line_pattern/{N;s/$git_index_line_pattern\n//;}" \
41-
| $SED -E "s/^($color_code_regex)\-\-\-(.*)$/\1$(print_horizontal_rule)\\n\1\-\-\-\5/g" \
42-
| $SED -E "s/^($color_code_regex)\+\+\+(.*)$/\1\+\+\+\5\\n\1$(print_horizontal_rule)/g"
43+
| $SED -E "s/^($color_code_regex)\-\-\-(.*)$/\1$(print_horizontal_rule)\\${NL}\1\-\-\-\-\5/g" \
44+
| $SED -E "s/^($color_code_regex)\+\+\+(.*)$/\1\+\+\+\+\5\\${NL}\1$(print_horizontal_rule)/g"
4345
}
4446

4547
colorize_context_line () {

0 commit comments

Comments
 (0)