]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix minor formatting issue, c385
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 7 Aug 2024 23:53:57 +0000 (16:53 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 7 Aug 2024 23:53:57 +0000 (16:53 -0700)
CHANGES.md
bin/perltidy
lib/Perl/Tidy/Formatter.pm

index 8098ec859360805586e2efa852d874c8551f2860..f498cb2546f6176b177580d37fad7d4f3c965124 100644 (file)
@@ -2,13 +2,13 @@
 
 ## 2024 05 11.09
 
-    - Add --timeout-in-seconds=n, or -to=n.  When the standard input supplies
+    - Add --timeout-in-seconds=n, or -tos=n.  When the standard input supplies
       the input stream, and the input has not been received within n seconds,
       perltidy will end with a timeout message.  The intention is to catch
       a situation where perltidy is accidentally invoked without a file to
       process and therefore waits for input from the system standard input
       (stdin), which never arrives.  The default is n=10.
-      This check can be turned off with -to=0.
+      This check can be turned off with -tos=0.
 
     - Add parameter --closing-side-comment-exclusion-list=string, or
       -cscxl=string, where string is a list of block types to exclude
index 15cb9d483391a08e566d02e0b11b54d75f633f1c..033bc420c27ee2dc42d0646ed0f0c46f4efe8dcf 100755 (executable)
@@ -420,7 +420,7 @@ other words that the input code is 'untidy' according to the formatting
 parameters.  If this is not the case, an error message noting this is produced.
 This flag has no other effect on the functioning of perltidy.
 
-=item B<-to=n>,   B<--timeout-in-seconds=n>
+=item B<-tos=n>,   B<--timeout-in-seconds=n>
 
 When the standard input supplies the input stream, and the input has not been
 received within B<n> seconds, perltidy will end with a timeout message.  The
index 9c1650cce6bb1033fa4bc5f8924e357d1b6e1694..fb3225a5e2e1b79c6426d3c11d77c43c468a591d 100644 (file)
@@ -8501,7 +8501,7 @@ sub set_CODE_type {
                 $CODE_type = $no_leading_space ? 'SBCX' : 'SBC';
                 next;
             }
-            elsif ($last_line_had_side_comment
+            elsif ( $last_line_had_side_comment
                 && !$rOpts_maximum_consecutive_blank_lines
                 && $rLL->[$Kfirst]->[_LEVEL_] > 0 )
             {
@@ -9906,7 +9906,7 @@ sub initialize_warn_hash {
             # Special check for -wvt
             # Deactivated for now to allow -wvt in perltidyrc files. This can
             # eventually be removed if allowing this does not cause problems.
-            elsif (0
+            elsif ( 0
                 && ( $opt eq 'u' || $opt eq 'c' )
                 && $long_name eq 'warn-variable-types' )
             {
@@ -14557,7 +14557,7 @@ sub count_list_elements {
             }
 
             # remember the name of the first item, maybe something like '$self'
-            elsif ($sigil eq '$'
+            elsif ( $sigil eq '$'
                 && !$self_name
                 && !$arg_count )
             {
@@ -35566,7 +35566,7 @@ sub undo_contained_ci {
                 }
 
                 # we might be able to handle a pad of -1 by removing a blank
-                # token
+                # token.
                 if ( $pad_spaces < 0 ) {
 
                     # Deactivated for -kpit due to conflict. This block deletes
@@ -35574,9 +35574,21 @@ sub undo_contained_ci {
                     # but it may conflict with user spacing requests.  For now
                     # it is just deactivated if the -kpit option is used.
                     if ( $pad_spaces == -1 ) {
-                        if (   $ipad > $ibeg
+                        if (
+                               $ipad > $ibeg
                             && $types_to_go[ $ipad - 1 ] eq 'b'
-                            && !%keyword_paren_inner_tightness )
+                            && !%keyword_paren_inner_tightness
+
+                            # additional tests added for c385:
+                            && (
+                                $types_to_go[$inext_next] eq $types_to_go[$ipad]
+                                || (
+                                    $types_to_go[$ipad] eq '!'
+                                    && ( $types_to_go[ $ipad + 1 ] eq
+                                        $types_to_go[$inext_next] )
+                                )
+                            )
+                          )
                         {
                             $self->pad_token( $ipad - 1, $pad_spaces );
                         }