File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -140,21 +140,21 @@ def get_width():
140
140
# The Windows get_terminal_size may be bogus, let's sanify a bit.
141
141
if width < 40 :
142
142
width = 80
143
- # The goal is to have the line be as long as possible
144
- # under the condition that len(line) <= fullwidth.
145
- if sys .platform == 'win32' :
146
- # If we print in the last column on windows we are on a
147
- # new line but there is no way to verify/neutralize this
148
- # (we may not know the exact line width).
149
- # So let's be defensive to avoid empty lines in the output.
150
- width -= 1
151
143
return width
152
144
153
145
def sep (self , stream , s , txt ):
154
146
if hasattr (stream , 'sep' ):
155
147
stream .sep (s , txt )
156
148
else :
157
149
fullwidth = self .get_width ()
150
+ # The goal is to have the line be as long as possible
151
+ # under the condition that len(line) <= fullwidth.
152
+ if sys .platform == 'win32' :
153
+ # If we print in the last column on windows we are on a
154
+ # new line but there is no way to verify/neutralize this
155
+ # (we may not know the exact line width).
156
+ # So let's be defensive to avoid empty lines in the output.
157
+ fullwidth -= 1
158
158
N = max ((fullwidth - len (txt ) - 2 ) // (2 * len (s )), 1 )
159
159
fill = s * N
160
160
line = f'{ fill } { txt } { fill } '
You can’t perform that action at this time.
0 commit comments