Skip to content

Commit 396652b

Browse files
committed
Added feature to append each command to the python history file as soon as user presses enter on the repl.
1 parent b78e0b8 commit 396652b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bpython/repl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,11 @@ def push(self, s, insert_into_history=True):
745745
s = s.rstrip('\n')
746746
self.buffer.append(s)
747747

748+
histfilename = os.path.expanduser(self.config.hist_file)
749+
748750
if insert_into_history:
749751
self.rl_history.append(s)
752+
self.rl_history.save(histfilename, getpreferredencoding())
750753

751754
more = self.interp.runsource('\n'.join(self.buffer))
752755

0 commit comments

Comments
 (0)