From: Steve Hancock Date: Tue, 8 Sep 2020 02:56:53 +0000 (-0700) Subject: fixed bug where long line with here target got broken X-Git-Tag: 20200907.01~39 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8f7e4cb0e4cd530ae662b3b0a2fbcb8102465022;p=perltidy.git fixed bug where long line with here target got broken --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 8c2bdfbf..305b6478 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3056,6 +3056,18 @@ sub respace_tokens { $rtoken_vars->[_TOKEN_] = $token; } + # change code type to be NIN at a here target to avoid breaking the line + elsif ( $type eq 'h' ) { + + # 'VB' = Verbatim - line goes out verbatim + # 'FS' = Format Skipping - line goes out verbatim, no blanks + # 'IO' = Indent Only - only indentation may be changed + unless ( $CODE_type && $CODE_type =~ /^(VB|FS|IO)$/ ) { + $CODE_type = 'NIN'; + $line_of_tokens->{_code_type} = $CODE_type; + } + } + # patch to add space to something like "x10" # This avoids having to split this token in the pre-tokenizer elsif ( $type eq 'n' ) { @@ -7736,6 +7748,7 @@ sub copy_token_as_type { } $no_internal_newlines = 1 - $rOpts_add_newlines; + $no_internal_newlines ||= $CODE_type eq 'NIN'; $side_comment_follows = 0; my $is_comment = ( $K_first == $K_last && $rLL->[$K_first]->[_TYPE_] eq '#' );