From: Steve Hancock Date: Sat, 10 Feb 2024 15:11:51 +0000 (-0800) Subject: -drc should only delete commas repeated on the same line X-Git-Tag: 20240202.02~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=40fe314224e7cb32dd444b89a38d6958a7124ba0;p=perltidy.git -drc should only delete commas repeated on the same line this avoids converting a side comment to a block comment --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index dccd5a42..173a029e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -11325,9 +11325,18 @@ EOM if ( $last_nonblank_code_type eq ',' && $rOpts->{'delete-repeated-commas'} ) { - # Could note this deletion as a possible future update: - ## $self->note_deleted_comma($input_line_number); - next; + + # do not delete a comma repeated on a different line - + # this can cause problems, such as promoting a side comment + # to a block comment. See test 'mangle4.in' + if ( $KK == $Kfirst ) { + ## but a warning could be issued + } + else { + # Could note this deletion as a possible future update: + ## $self->note_deleted_comma($input_line_number); + next; + } } # remember input line index of first comma if -wtc is used