File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -339,8 +339,9 @@ def clear_current_line(self):
339339 def clear_wrapped_lines (self ):
340340 """Clear the wrapped lines of the current input."""
341341 # curses does not handle this on its own. Sad.
342- width = self .scr .getmaxyx ()[1 ]
343- for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
342+ height , width = self .scr .getmaxyx ()
343+ max_y = min (self .iy + len (self .s ) // width + 1 , height )
344+ for y in xrange (self .iy + 1 , max_y ):
344345 self .scr .move (y , 0 )
345346 self .scr .clrtoeol ()
346347
@@ -478,12 +479,7 @@ def fwd(self):
478479 """Same as back() but, well, forward"""
479480
480481 self .cpos = 0
481-
482- width = self .scr .getmaxyx ()[1 ]
483- for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
484- self .scr .move (y , 0 )
485- self .scr .clrtoeol ()
486-
482+ self .clear_wrapped_lines ()
487483 self .rl_history .enter (self .s )
488484 self .s = self .rl_history .forward ()
489485 self .print_line (self .s , clr = True )
You can’t perform that action at this time.
0 commit comments