File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ def MustSplit(self):
213
213
# Allow the fallthrough code to handle the closing bracket.
214
214
if current != opening .matching_bracket :
215
215
# If the container doesn't fit in the current line, must split
216
- return not self ._ContainerFitsOnStartLine (opening )
216
+ if (subtypes .COMP_FOR not in current .subtypes and
217
+ not self ._ContainerFitsOnStartLine (opening )):
218
+ return True
217
219
218
220
if (self .stack [- 1 ].split_before_closing_bracket and
219
221
(current .value in '}]' and style .Get ('SPLIT_BEFORE_CLOSING_BRACKET' ) or
@@ -557,9 +559,14 @@ def SurroundedByParens(token):
557
559
return True
558
560
else :
559
561
# Split after the opening of a container if it doesn't fit on the
560
- # current line.
562
+ # current line, including checking for wrapping .
561
563
if not self ._FitsOnLine (previous , previous .matching_bracket ):
562
- return True
564
+ arg_lengths = _CalculateArgLengths (previous )
565
+ start_col = self .column + len (current .value ) + len (previous .value )
566
+ for length in arg_lengths :
567
+ length += start_col
568
+ if length > self .column_limit :
569
+ return True
563
570
564
571
###########################################################################
565
572
# Original Formatting Splitting
You can’t perform that action at this time.
0 commit comments