Closed nasyxx closed 6 years ago
Based on this it looks like this behavior is by design. That said, I had gotten in the (bad?) habit of using Ctrl-C to abort my current train of thought and undo typing (similar to Ctrl-G in other applications).
Adding this to my ~/.ptpython/config.py
seems to restore that behavior, while still allowing Ctrl-C to interrupt long-running calls:
@repl.add_key_binding(Keys.ControlC)
def _(event):
event.cli.current_buffer.text = ""
Maybe this will be useful to you too.
Based on this it looks like this behavior is by design. That said, I had gotten in the (bad?) habit of using Ctrl-C to abort my current train of thought and undo typing (similar to Ctrl-G in other applications).
Adding this to my
~/.ptpython/config.py
seems to restore that behavior, while still allowing Ctrl-C to interrupt long-running calls:@repl.add_key_binding(Keys.ControlC) def _(event): event.cli.current_buffer.text = ""
Maybe this will be useful to you too.
Thanks a lot for teaching me to execute C-c like this.
And it seems that it has not happened again.
done:
~/.ptpython/config.py:
def configure(repl):
# ......
@repl.add_key_binding("c-c", filter=ViInsertMode())
def _(event):
"类似shell的ctrl-c "
event.cli.current_buffer.text = ""
# event.cli.key_processor.feed(KeyPress("escape"))
ctrl+c will stop ptipython on macOS. Here is the traceback.