@@ -1249,6 +1249,7 @@ def back(self):
12491249 if self .h_i < len (self .rl_hist ):
12501250 self .h_i += 1
12511251
1252+ self .clear_wrapped_lines ()
12521253 self .s = self .rl_hist [- self .h_i ].rstrip ('\n ' )
12531254 self .print_line (self .s , clr = True )
12541255
@@ -1259,6 +1260,11 @@ def fwd(self):
12591260
12601261 self .cpos = 0
12611262
1263+ width = self .scr .getmaxyx ()[1 ]
1264+ for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
1265+ self .scr .move (y , 0 )
1266+ self .scr .clrtoeol ()
1267+
12621268 if self .h_i > 1 :
12631269 self .h_i -= 1
12641270 self .s = self .rl_hist [- self .h_i ].rstrip ('\n ' )
@@ -1549,12 +1555,7 @@ def bs(self, delete_tabs=True):
15491555
15501556 n = 1
15511557
1552- # Delete following lines if the current string is greater than the
1553- # screen width. Curses does not handle that on its own.
1554- width = self .scr .getmaxyx ()[1 ]
1555- for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
1556- self .scr .move (y , 0 )
1557- self .scr .clrtoeol ()
1558+ self .clear_wrapped_lines ()
15581559
15591560 if not self .cpos :
15601561# I know the nested if blocks look nasty. :(
@@ -1604,12 +1605,7 @@ def yank_from_buffer(self):
16041605
16051606 def clrtobol (self ):
16061607 """Clear from cursor to beginning of line; usual C-u behaviour"""
1607- # It seems as if curses does not handle this on its own, which
1608- # makes me sad.
1609- width = self .scr .getmaxyx ()[1 ]
1610- for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
1611- self .scr .move (y , 0 )
1612- self .scr .clrtoeol ()
1608+ self .clear_wrapped_lines ()
16131609
16141610 if not self .cpos :
16151611 self .s = ''
@@ -1620,6 +1616,15 @@ def clrtobol(self):
16201616 self .scr .redrawwin ()
16211617 self .scr .refresh ()
16221618
1619+ def clear_wrapped_lines (self ):
1620+ """Clear the wrapped lines of the current input."""
1621+ # curses does not handle this on its own. Sad.
1622+ width = self .scr .getmaxyx ()[1 ]
1623+ for y in xrange (self .iy + 1 , self .iy + len (self .s ) // width + 1 ):
1624+ self .scr .move (y , 0 )
1625+ self .scr .clrtoeol ()
1626+
1627+
16231628 def p_key (self , key ):
16241629 """Process a keypress"""
16251630
0 commit comments