@@ -493,14 +493,14 @@ def main():
493
493
494
494
new_sb_lines = []
495
495
for line in seleniumbase_lines :
496
- line_length = len (line )
497
- line_length2 = len (line )
498
- line_length = get_width (line )
496
+ line_length2 = len (line ) # Normal Python string length used
497
+ line_length = get_width (line ) # Special characters count 2X
499
498
if line_length > code_width :
500
499
code_width = line_length
501
500
502
501
if console_width :
503
- # If line is larger than console_width, try to optimize it
502
+ # If line is larger than console_width, try to optimize it.
503
+ # Smart Python word wrap to be used with valid indentation.
504
504
if line_length + w > console_width : # 5 is line number ws
505
505
if line .count (' # ' ) == 1 : # Has comments like this
506
506
if get_width (
@@ -582,6 +582,38 @@ def main():
582
582
else :
583
583
new_sb_lines .append (line )
584
584
continue
585
+ elif line .count ('= "' ) == 1 and line .count ('://' ) == 1 :
586
+ whitespace = line_length2 - len (line .lstrip ())
587
+ new_ws = line [0 :whitespace ] + " "
588
+ line1 = line .split ('://' )[0 ] + '://" \\ '
589
+ line2 = new_ws + '"' + line .split ('://' )[1 ]
590
+ new_sb_lines .append (line1 )
591
+ if get_width (line2 ) + w > console_width :
592
+ if line2 .count ('/' ) > 0 :
593
+ slash_one = line2 .find ('/' )
594
+ line2a = line2 [:slash_one + 1 ] + '" \\ '
595
+ line2b = new_ws + '"' + line2 [slash_one + 1 :]
596
+ new_sb_lines .append (line2a )
597
+ new_sb_lines .append (line2b )
598
+ continue
599
+ new_sb_lines .append (line2 )
600
+ continue
601
+ elif line .count ("= '" ) == 1 and line .count ('://' ) == 1 :
602
+ whitespace = line_length2 - len (line .lstrip ())
603
+ new_ws = line [0 :whitespace ] + " "
604
+ line1 = line .split ('://' )[0 ] + '://" \\ '
605
+ line2 = new_ws + "'" + line .split ('://' )[1 ]
606
+ new_sb_lines .append (line1 )
607
+ if get_width (line2 ) + w > console_width :
608
+ if line2 .count ('/' ) > 0 :
609
+ slash_one = line2 .find ('/' )
610
+ line2a = line2 [:slash_one + 1 ] + "' \\ "
611
+ line2b = new_ws + "'" + line2 [slash_one + 1 :]
612
+ new_sb_lines .append (line2a )
613
+ new_sb_lines .append (line2b )
614
+ continue
615
+ new_sb_lines .append (line2 )
616
+ continue
585
617
new_sb_lines .append (line )
586
618
587
619
if new_sb_lines :
0 commit comments