Skip to content

Commit 949bd1f

Browse files
committed
Condense comments on indicator extraction
1 parent 6de40a1 commit 949bd1f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

showlinenum.awk

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,10 @@ function strip_ansi_color_codes( input )
492492
}
493493

494494

495-
# I'm using match() to get the location of the indicator character because if I were to use
496-
# gensub() I'd have to strip the diff line of ansi color codes either before or after since it
497-
# can embed the color codes in a match. I think it would be slower to strip every diff line if
498-
# done before, or if done after it could lead to corruption if internally gensub() prepends or
499-
# appends escape codes to the indicator that it finds in the diff line itself (ie actually part
500-
# of the diff line, not the colorization added by git diff). Unfortunately early versions of
501-
# gawk (like the one included with git for Windows) do not support an array parameter for
502-
# match() so the indicator must be extracted on success by using substr().
495+
# Extract the indicator. Unfortunately early versions of gawk (like the one included with git
496+
# for Windows) do not support an array parameter for match() so the indicator must be extracted
497+
# on success by using substr().
498+
503499
if( ( $0 !~ /^(\033\[[0-9;]*m)*[\\ +-]/ ) || !match( $0, /[\\ +-]/ ) || ( RLENGTH != 1 ) )
504500
{
505501
errmsg = "Failed to extract indicator from diff line.";

0 commit comments

Comments
 (0)