77 Optional ,
88 IO ,
99 Dict ,
10+ Sequence ,
1011 TypeVar ,
1112 Type ,
1213 Tuple ,
@@ -197,12 +198,9 @@ def render_to_terminal(
197198 self .on_terminal_size_change (height , width )
198199
199200 current_lines_by_row : Dict [int , Optional [FmtStr ]] = {}
200- rows = list (range (height ))
201- rows_for_use = rows [: len (array )]
202- rest_of_rows = rows [len (array ) :]
203201
204202 # rows which we have content for and don't require scrolling
205- for row , line in zip ( rows_for_use , array ):
203+ for row , line in enumerate ( array ):
206204 current_lines_by_row [row ] = line
207205 if line == self ._last_lines_by_row .get (row , None ):
208206 continue
@@ -212,7 +210,7 @@ def render_to_terminal(
212210 self .write (self .t .clear_eol )
213211
214212 # rows onscreen that we don't have content for
215- for row in rest_of_rows :
213+ for row in range ( len ( array ), height ) :
216214 if self ._last_lines_by_row and row not in self ._last_lines_by_row :
217215 continue
218216 self .write (self .t .move (row , 0 ))
@@ -421,7 +419,9 @@ def _get_cursor_vertical_diff_once(self) -> int:
421419 return cursor_dy
422420
423421 def render_to_terminal (
424- self , array : Union [FSArray , List [FmtStr ]], cursor_pos : Tuple [int , int ] = (0 , 0 )
422+ self ,
423+ array : Union [FSArray , Sequence [FmtStr ]],
424+ cursor_pos : Tuple [int , int ] = (0 , 0 ),
425425 ) -> int :
426426 """Renders array to terminal, returns the number of lines scrolled offscreen
427427
0 commit comments