File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -974,6 +974,7 @@ sub set_ansi_color {
974974 }
975975}
976976
977+ # Is the string 100% numeric
977978sub is_numeric {
978979 my $s = shift ();
979980
@@ -984,6 +985,7 @@ sub is_numeric {
984985 return 0;
985986}
986987
988+ # Does the string start with ANSI
987989sub starts_with_ansi {
988990 my $str = shift ();
989991
@@ -1054,6 +1056,7 @@ sub show_debug_info {
10541056 print " Operating System: $^O\n " ;
10551057}
10561058
1059+ # Boolean to yes/no string
10571060sub yes_no {
10581061 my $val = shift ();
10591062
@@ -1073,6 +1076,7 @@ sub init_diff_highlight_colors {
10731076 $DiffHighlight::OLD_HIGHLIGHT [1] = git_ansi_color(git_config(' color.diff-highlight.oldhighlight' )) || $DiffHighlight::OLD_HIGHLIGHT [1];
10741077}
10751078
1079+ # Write a line to the debug log which is opened on the fly as-needed
10761080sub debug_log {
10771081 my $log_line = shift ();
10781082 my $file = " /tmp/diff-so-fancy.debug.log" ;
@@ -1088,12 +1092,16 @@ sub debug_log {
10881092 return 1;
10891093}
10901094
1095+ # Count the number of context lines in the diff
10911096sub calculate_context_lines {
10921097 my @lines = @_ ;
10931098 my $count = 0;
10941099 my $hunk_line = 0;
10951100
1101+ # Count the number of lines between the hunk line and the
1102+ # first + or - line
10961103 foreach my $line (@lines ) {
1104+ # Look for the hunk line before we start
10971105 if ($line =~ / ^${ansi_color_regex} (@@@* .+? @@@*)(.*)/ ) {
10981106 $hunk_line = $count ;
10991107 } elsif ($hunk_line && $line =~ / ^${ansi_color_regex} [+-]/ ) {
You can’t perform that action at this time.
0 commit comments