From cdc11570a23a18fa7e94595d5d8764e5f1ff759f Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 7 Jul 2023 07:51:27 -0700 Subject: [PATCH] fix issue b1457 --- dev-bin/run_convergence_tests.pl.data | 41 +++++++++++++++++++++++++ dev-bin/run_convergence_tests.pl.expect | 32 +++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 10 ++++++ 3 files changed, 83 insertions(+) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 9e4b98c6..2cbc5811 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -11625,6 +11625,47 @@ if ($BOLD_MATH) { --short-concatenation-item-length=1 --want-trailing-commas='h' +==> b1457.in <== +BEGIN { + %messages=( + 0x95 => [ + StartSessionTransmission => + qw( *_RemoteIPAddr V_SessionType ) + ], + 0x93 => [ + ConfigStat =>qw( Z16_DeviceName V_StationUserID + V_StationUserInstance + Z16_UserName Z16_ServerName + V_NumberLines V_NumberSpeedDials ) + ], + ) ; +} + +BEGIN { + %messages=( + 0x95 => [ + StartSessionTransmission => + qw( *_RemoteIPAddr V_SessionType ) + ], + 0x93 => [ + ConfigStat => + qw( Z16_DeviceName V_StationUserID + V_StationUserInstance + Z16_UserName Z16_ServerName + V_NumberLines V_NumberSpeedDials ) + ], + ) ; +} + + +==> b1457.par <== +--maximum-line-length=76 +--indent-columns=9 +--continuation-indentation=9 +--noadd-whitespace +--extended-continuation-indentation +--extended-line-up-parentheses + ==> b146.in <== # State 1 diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index 68fb8f17..f19eb819 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -7869,6 +7869,38 @@ if ($BOLD_MATH) { " " . $user->{lastname}, selected => '0', }; +==> b1457 <== +BEGIN { + %messages=( + 0x95 => [ + StartSessionTransmission => + qw( *_RemoteIPAddr V_SessionType ) + ], + 0x93 => [ + ConfigStat =>qw( Z16_DeviceName V_StationUserID + V_StationUserInstance + Z16_UserName Z16_ServerName + V_NumberLines V_NumberSpeedDials ) + ], + ) ; +} + +BEGIN { + %messages=( + 0x95 => [ + StartSessionTransmission => + qw( *_RemoteIPAddr V_SessionType ) + ], + 0x93 => [ + ConfigStat =>qw( Z16_DeviceName V_StationUserID + V_StationUserInstance + Z16_UserName Z16_ServerName + V_NumberLines V_NumberSpeedDials ) + ], + ) ; +} + + ==> b146 <== # State 1 diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ba5499a8..223462eb 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -14370,6 +14370,16 @@ EOM # Count lengths of things like 'xx => yy' as a single item if ( $type eq '=>' ) { $len += $token_length + 1; + + # fix $len for -naws, issue b1457 + if ( !$rOpts_add_whitespace ) { + if ( defined( $rLL->[ $KK + 1 ] ) + && $rLL->[ $KK + 1 ]->[_TYPE_] ne 'b' ) + { + $len -= 1; + } + } + if ( $len > $max_prong_len ) { $max_prong_len = $len } } elsif ( $last_nonblank_type eq '=>' ) { -- 2.39.5