Skip to content

Commit f586f54

Browse files
committed
Check for empty buffer in FakeStdin.readline().
1 parent 956899f commit f586f54

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bpython/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ def readline(self):
188188
while True:
189189
key = self.interface.get_key()
190190
if key in [curses.erasechar(), 'KEY_BACKSPACE']:
191-
buffer = buffer[:-1]
192191
y, x = self.interface.scr.getyx()
193-
if x:
192+
if buffer:
194193
self.interface.scr.delch(y, x - 1)
194+
buffer = buffer[:-1]
195195
continue
196-
elif (key != '\n' and
196+
elif (key != '\n' and
197197
(len(key) > 1 or unicodedata.category(key) == 'Cc')):
198198
continue
199199
sys.stdout.write(key)

0 commit comments

Comments
 (0)