From f005a955a7776cd00b8018da9aa94a20392f0dcc Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 15 Feb 2021 18:24:12 -0800 Subject: [PATCH] Avoid line breaks after token type 'G' --- lib/Perl/Tidy/Formatter.pm | 5 +++++ local-docs/BugLog.pod | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 1cfd1035..73badc8f 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3183,6 +3183,11 @@ EOM $nobreak_rhs{'F'} = NO_BREAK; $nobreak_rhs{'CORE::'} = NO_BREAK; + # To prevent the tokenizer from switching between types 'w' and 'G' we + # need to avoid breaking between type 'G' and the following code block + # brace. Fixes case b929. + $nobreak_rhs{G} = NO_BREAK; + #--------------------------------------------------------------- # Bond Strength BEGIN Section 3. # Define tables and values for applying a small bias to the above diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 0bf55455..e99b064c 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,19 @@ =over 4 +=item B + +Random testing whith very short maximum line lengths produced some blinking +states which were traced to the tokenizer alternately parsed an unknown +bareword as type 'w' or type 'G', depending on whether or not an opening block +brace immediately followed on the same line. To fix this, a rule was added +which prevents a line break between a type 'G' token and an opening code block +brace. + +This update fixes these cases: b900 b902 b928 b929 + +15 Feb 2021. + =item B Random testing with very short maximum line lengths produced some blinking @@ -10,7 +23,7 @@ were not really good breakpoints. A patch was made to be more selective. These cases are fixed with this update: b610 b757 b931 -15 Feb 2021. +15 Feb 2021, 98b41a0. =item B -- 2.39.5