@@ -143,18 +143,7 @@ def __init__(
143
143
- term (str): Terminal name.
144
144
- encoding (str): Encoding to use for I/O operations.
145
145
"""
146
-
147
- self .encoding = encoding or sys .getdefaultencoding ()
148
-
149
- if isinstance (f_in , int ):
150
- self .input_fd = f_in
151
- else :
152
- self .input_fd = f_in .fileno ()
153
-
154
- if isinstance (f_out , int ):
155
- self .output_fd = f_out
156
- else :
157
- self .output_fd = f_out .fileno ()
146
+ super ().__init__ (f_in , f_out , term , encoding )
158
147
159
148
self .pollob = poll ()
160
149
self .pollob .register (self .input_fd , select .POLLIN )
@@ -592,14 +581,19 @@ def __write_changed_line(self, y, oldline, newline, px_coord):
592
581
px_pos = 0
593
582
j = 0
594
583
for c in oldline :
595
- if j >= px_coord : break
584
+ if j >= px_coord :
585
+ break
596
586
j += wlen (c )
597
587
px_pos += 1
598
588
599
589
# reuse the oldline as much as possible, but stop as soon as we
600
590
# encounter an ESCAPE, because it might be the start of an escape
601
591
# sequene
602
- while x_coord < minlen and oldline [x_pos ] == newline [x_pos ] and newline [x_pos ] != "\x1b " :
592
+ while (
593
+ x_coord < minlen
594
+ and oldline [x_pos ] == newline [x_pos ]
595
+ and newline [x_pos ] != "\x1b "
596
+ ):
603
597
x_coord += wlen (newline [x_pos ])
604
598
x_pos += 1
605
599
@@ -619,7 +613,11 @@ def __write_changed_line(self, y, oldline, newline, px_coord):
619
613
self .__posxy = x_coord + character_width , y
620
614
621
615
# if it's a single character change in the middle of the line
622
- elif x_coord < minlen and oldline [x_pos + 1 :] == newline [x_pos + 1 :] and wlen (oldline [x_pos ]) == wlen (newline [x_pos ]):
616
+ elif (
617
+ x_coord < minlen
618
+ and oldline [x_pos + 1 :] == newline [x_pos + 1 :]
619
+ and wlen (oldline [x_pos ]) == wlen (newline [x_pos ])
620
+ ):
623
621
character_width = wlen (newline [x_pos ])
624
622
self .__move (x_coord , y )
625
623
self .__write (newline [x_pos ])
0 commit comments