def next(self):
try:
l = raw_input(self.prompt+"> ")
if self.controlc:
#rl_done.value = 0
self.controlc = None
return None
return l
except (EOFError):
quit = True
print "\nKTHXBYE!"
except KeyboardInterrupt:
# user pressed ctrl-c whilst something was
# in the buffer. Make the code skip the next line of input.
if len(readline.get_line_buffer())>0:
#self.controlc = readline.get_line_buffer()
self.controlc = True
#print "rlbuf: ",rl_line_buffer.value
#rl_line_buffer.value = ""
#print "rl_done = ",rl_done
#rl_done.value = 1
#print "rl_done = ",rl_done
print "\nYour next line of input might be ignored.\nI have not understood readline's ^C handling good enough to make it work.\nFor the moment just type <enter> and ignore the displayed text."
return None
if quit:
raise StopIteration
评论列表
文章目录