From 29e2acbf967a4e0ef5101c046af810212f332ec6 Mon Sep 17 00:00:00 2001 From: Bob Farrell Date: Sat, 16 Aug 2008 10:39:42 +0100 Subject: [PATCH] Extra linebreak added to stdout output and C-d behaviour changed. The extra linebreak was irritating but I didn't notice it on my setup because I already have a linebreak on exit, or something. Also C-d now only exits if there's a blank line, as per the vanilla interpreter. --- bpython.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bpython.py b/bpython.py index 3fd7bf5..40c182a 100644 --- a/bpython.py +++ b/bpython.py @@ -578,7 +578,7 @@ class Repl( object ): """This method returns the 'spoofed' stdout buffer, for writing to a file or sending to a pastebin or whatever.""" - return self.stdout_hist#"\n".join( self.stdout_hist ) + return self.stdout_hist + '\n' def write2file( self ): """Prompt for a filename and write the current contents of the stdout buffer @@ -1006,8 +1006,11 @@ class Repl( object ): return '' elif self.c in ( chr(4), '^D' ): # C-d - self.do_exit = True - return None + if not self.s: + self.do_exit = True + return None + else: + return '' elif self.c == 'KEY_F(2)': self.write2file()