X Tutup
Skip to content

Commit e84680f

Browse files
committed
Issue #123 fixed for bpython-urwid
1 parent 5498a38 commit e84680f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bpython/urwid.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,12 @@ def __init__(self, config, statusbar=None):
391391

392392
def confirm(self, q):
393393
"""Ask for yes or no and return boolean"""
394-
return self.statusbar.prompt(q).lower().startswith('y')
394+
try:
395+
reply = self.statusbar.prompt(q)
396+
except ValueError:
397+
return False
398+
399+
return reply.lower() in ('y', 'yes')
395400

396401
def notify(self, s, n=10):
397402
return self.statusbar.message(s, n)
@@ -597,7 +602,12 @@ def getstdout(self):
597602

598603
def ask_confirmation(self, q):
599604
"""Ask for yes or no and return boolean"""
600-
return self.statusbar.prompt(q).lower().startswith('y')
605+
try:
606+
reply = self.statusbar.prompt(q)
607+
except ValueError:
608+
return False
609+
610+
return reply.lower() in ('y', 'yes')
601611

602612
def reevaluate(self):
603613
"""Clear the buffer, redraw the screen and re-evaluate the history"""

0 commit comments

Comments
 (0)
X Tutup