From 20d2a998e66620576b4bd34be43d6218afbd598b Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 20 Apr 2022 20:37:22 -0700 Subject: [PATCH] work around conflict of -vmll -xci -bbxi=2 (b1336) --- dev-bin/run_convergence_tests.pl.data | 24 ++++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 8 +++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 260f108f..81bb70cc 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9729,6 +9729,30 @@ params => --indent-columns=0 --maximum-line-length=96 +==> b1336.in <== +# S1 + my $expect = + [ + { + type => 'preformatted', + text => "preformatted line\n", + } + ]; + +# S2 + my $expect = + [ + { type => 'preformatted', text => "preformatted line\n", } ]; + +==> b1336.par <== +--break-before-square-bracket-and-indent=2 +--break-before-square-bracket=2 +--continuation-indentation=8 +--extended-continuation-indentation +--ignore-old-breakpoints +--maximum-line-length=63 +--variable-maximum-line-length + ==> b1337.in <== # S1: 'new' was given type 'i' here print JSON::PP->new diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3b67d57a..b069f395 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -10188,7 +10188,13 @@ sub break_before_list_opening_containers { next; } - # -bbxi=2 ... + # -bbxi=2: This option changes the level ... + # This option can conflict with -xci in some cases. We can turn off + # -xci for this container to avoid blinking. For now, only do this if + # -vmll is set. ( fixes b1335, b1336 ) + if ($rOpts_variable_maximum_line_length) { + $rno_xci_by_seqno->{$seqno} = 1; + } #---------------------------------------------------------------- # Part 2: Perform tests before committing to changing ci and level -- 2.39.5