]> git.donarmstrong.com Git - perltidy.git/commitdiff
Avoid line breaks after token type 'G'
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Feb 2021 02:24:12 +0000 (18:24 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Feb 2021 02:24:12 +0000 (18:24 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 1cfd10358f9c8c05a32f487d12663074d5a3f7ae..73badc8f2481c9f96a9224ae1b419c0747353a79 100644 (file)
@@ -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
index 0bf55455ec849ff0d68560eea0cac5ec98696744..e99b064c5b8ff51cf4d8b1e16de9acea84c392c9 100644 (file)
@@ -2,6 +2,19 @@
 
 =over 4
 
+=item B<Avoid line breaks after token type 'G'>
+
+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<Restrict breaking at old uncontained commas>
 
 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<Modify line length test for the -vtc=2 option>