Skip to content

Commit eb83bd1

Browse files
committed
Prevent parent patching in reevaluation and restore indentation when done.
1 parent 2f8e682 commit eb83bd1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bpython/repl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,8 @@ def reevaluate(self):
653653
self.buffer = []
654654
self.scr.erase()
655655
self.s_hist = []
656+
# Set cursor position to -1 to prevent paren matching
657+
self.cpos = -1
656658

657659
self.prompt(False)
658660

@@ -671,9 +673,14 @@ def reevaluate(self):
671673
self.prompt(more)
672674
self.iy, self.ix = self.scr.getyx()
673675

676+
self.cpos = 0
677+
indent = next_indentantion(self.s)
674678
self.s = ''
675679
self.scr.refresh()
676680

681+
for _ in xrange(indent):
682+
self.tab()
683+
677684
self.evaluating = False
678685
#map(self.push, self.history)
679686
#^-- That's how simple this method was at first :(

0 commit comments

Comments
 (0)