Skip to content

Commit dd6e3b3

Browse files
committed
Fix off-by-one in lines-to-clear calculation and remove some unneeded code.
1 parent 41b2f83 commit dd6e3b3

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

bpython/cli.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,14 +1487,10 @@ def bs(self, delete_tabs=True):
14871487

14881488
n = 1
14891489

1490-
if x == 0:
1491-
y -= 1
1492-
x = gethw()[1]
1493-
14941490
# Delete following lines if the current string is greater than the
14951491
# screen width. Curses does not handle that on its own.
14961492
width = self.scr.getmaxyx()[1]
1497-
for y in xrange(self.iy + 1, self.iy + len(self.s) // width + 2):
1493+
for y in xrange(self.iy + 1, self.iy + len(self.s) // width + 1):
14981494
self.scr.move(y, 0)
14991495
self.scr.clrtoeol()
15001496

@@ -1549,7 +1545,7 @@ def clrtobol(self):
15491545
# It seems as if curses does not handle this on its own, which
15501546
# makes me sad.
15511547
width = self.scr.getmaxyx()[1]
1552-
for y in xrange(self.iy + 1, self.iy + len(self.s) // width + 2):
1548+
for y in xrange(self.iy + 1, self.iy + len(self.s) // width + 1):
15531549
self.scr.move(y, 0)
15541550
self.scr.clrtoeol()
15551551

0 commit comments

Comments
 (0)