prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

shortcut next_history not working on windows #1788

Open roachsinai opened 9 months ago

roachsinai commented 9 months ago

reproduce

add below code to ~/.ipython/profile_default/startup/00-keybindings.py

from IPython import get_ipython
from prompt_toolkit.enums import DEFAULT_BUFFER
import prompt_toolkit.key_binding.bindings.named_commands as nc
from prompt_toolkit.filters import HasFocus, ViInsertMode

ip = get_ipython()

if getattr(ip, 'pt_app', None):
    registry = ip.pt_app.key_bindings

    registry.add_binding('c-j',
                         filter=(HasFocus(DEFAULT_BUFFER)
                                 & ViInsertMode()))(nc.next_history)

Above setting works on WSL, but not working on Window ipython open in powershell.

But shortcut like previous_history works both on WSL and Windows.