File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,15 @@ def main():
198198 new_sb_lines .append (line1 )
199199 new_sb_lines .append (line2 )
200200 continue
201- if line .count ("(" ) == 1 and line .count (")" ) == 1 :
201+ if (
202+ line .count ("(" ) >= 1
203+ and line .count ("(" ) == line .count (")" )
204+ ):
202205 whitespace = line_length2 - len (line .lstrip ())
203206 new_ws = line [0 :whitespace ] + " "
204- line1 = line .split ("(" )[0 ] + "("
205- line2 = new_ws + line .split ("(" )[1 ]
207+ first_paren = line .find ("(" )
208+ line1 = line [:first_paren + 1 ]
209+ line2 = new_ws + line [first_paren + 1 :]
206210 if not ("):" ) in line2 :
207211 new_sb_lines .append (line1 )
208212 if get_width (line2 ) + w > console_width :
@@ -302,9 +306,7 @@ def main():
302306 continue
303307 elif line2 .count (", " ) == 1 :
304308 line2a = line2 .split (", " )[0 ] + ","
305- line2b = new_ws + (
306- line2 .split (", " )[1 ]
307- )
309+ line2b = new_ws + line2 .split (", " )[1 ]
308310 new_sb_lines .append (line2a )
309311 new_sb_lines .append (line2b )
310312 continue
Original file line number Diff line number Diff line change @@ -620,11 +620,15 @@ def main():
620620 new_sb_lines .append (line1 )
621621 new_sb_lines .append (line2 )
622622 continue
623- if line .count ("(" ) == 1 and line .count (")" ) == 1 :
623+ if (
624+ line .count ("(" ) >= 1
625+ and line .count ("(" ) == line .count (")" )
626+ ):
624627 whitespace = line_length2 - len (line .lstrip ())
625628 new_ws = line [0 :whitespace ] + " "
626- line1 = line .split ("(" )[0 ] + "("
627- line2 = new_ws + line .split ("(" )[1 ]
629+ first_paren = line .find ("(" )
630+ line1 = line [:first_paren + 1 ]
631+ line2 = new_ws + line [first_paren + 1 :]
628632 if not ("):" ) in line2 :
629633 new_sb_lines .append (line1 )
630634 if get_width (line2 ) + w > console_width :
@@ -722,9 +726,7 @@ def main():
722726 continue
723727 elif line2 .count (", " ) == 1 :
724728 line2a = line2 .split (", " )[0 ] + ","
725- line2b = new_ws + (
726- line2 .split (", " )[1 ]
727- )
729+ line2b = new_ws + line2 .split (", " )[1 ]
728730 new_sb_lines .append (line2a )
729731 new_sb_lines .append (line2b )
730732 continue
You can’t perform that action at this time.
0 commit comments