diff --git a/interpreter/terminal_interface/terminal_interface.py b/interpreter/terminal_interface/terminal_interface.py index fff048240d..d2d160745e 100644 --- a/interpreter/terminal_interface/terminal_interface.py +++ b/interpreter/terminal_interface/terminal_interface.py @@ -3,6 +3,7 @@ If you were to build a frontend this would be a way to do it """ +import readline from .components.code_block import CodeBlock from .components.message_block import MessageBlock from .magic_commands import handle_magic_command @@ -110,6 +111,9 @@ def terminal_interface(interpreter, message): if response.strip().lower() == "y": should_scan_code = True + + # remove y/n from history so that user can more easily find last command + readline.remove_history_item(readline.get_current_history_length() - 1) if should_scan_code: # Get code language and actual code from the chunk @@ -137,6 +141,9 @@ def terminal_interface(interpreter, message): }) break + # remove y/n from history so that user can more easily find last command + readline.remove_history_item(readline.get_current_history_length() - 1) + # Output if "output" in chunk: ran_code_block = True