Skip to content

Commit 192cbe9

Browse files
take back line working for bpythno-curtsies
1 parent 0513f1a commit 192cbe9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,13 @@ def reprint_line(self, lineno, tokens):
11931193
logger.debug("calling reprint line with %r %r", lineno, tokens)
11941194
if self.config.syntax:
11951195
self.display_buffer[lineno] = bpythonparse(format(tokens, self.formatter))
1196+
1197+
def take_back_buffer_line(self):
1198+
self.display_buffer.pop()
1199+
self.buffer.pop()
1200+
self.cursor_offset = 0
1201+
self.current_line = ''
1202+
11961203
def reevaluate(self, insert_into_history=False):
11971204
"""bpython.Repl.undo calls this"""
11981205
if self.watcher: self.watcher.reset()

bpython/repl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,10 @@ def undo(self, n=1):
902902
entries = list(self.rl_history.entries)
903903

904904
self.history = self.history[:-n]
905-
906-
self.reevaluate()
905+
if n == 1 and not self.done:
906+
self.take_back_buffer_line()
907+
else:
908+
self.reevaluate()
907909

908910
self.rl_history.entries = entries
909911

0 commit comments

Comments
 (0)