Skip to content

Commit

Permalink
TkTerminal.handle_return: clear history so up-arrow works correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanDunfield committed Dec 27, 2024
1 parent ad828f6 commit 005871a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/tkterminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __init__(self, shell, name='TkTerm'):
self.blockers = {}
self.can_quit = True
self.close_callback = lambda :None

# Emulate a ListedWindow. We are listed, even though we are unique.
def bring_to_front(self):
self.window.deiconify()
Expand Down Expand Up @@ -363,7 +363,7 @@ def handle_return(self, event=None):
if cursor == first == last - 1: # single line input
self.text.mark_set(Tk_.INSERT, Tk_.END)
self.text.insert(Tk_.INSERT, '\n')
cell = self.text.get('output_end', Tk_.INSERT)
cell = self.text.get('output_end', Tk_.INSERT)
try:
self.interact_handle_input(cell)
except KeyboardInterrupt:
Expand All @@ -375,6 +375,8 @@ def handle_return(self, event=None):
self.text.see(Tk_.INSERT)
if self.IP.more:
self.text.insert(Tk_.INSERT, ' '*self._current_indent, ())
self.hist_pointer = 0
self.hist_stem = ''
return 'break'

def handle_shift_return(self, event):
Expand Down

0 comments on commit 005871a

Please sign in to comment.