Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vi input mode enum bug #289

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jsr-p
Copy link

@jsr-p jsr-p commented Mar 30, 2023

With the vi options

c.ZMQTerminalInteractiveShell.editing_mode = 'vi'
c.ZMQTerminalInteractiveShell.prompt_includes_vi_mode = True

specified in jupyter_console_config.py, the terminal output, in all vi modes, looks like:

2023-03-30T09:45:19,921232808+02:00

The reason for the error is found here.
The Enum self.pt_cli.app.vi_state.input_mode is passed into the str function, which only shows the the enum name and member name, not the value of the member, cf the Python docs.
The Enum used is the InputMode.INSERT Enum from prompt_toolkit defined here.
Applying the str function returns InputMode.INSERT and subsetting this with [3:6] yields the utM shown in the terminal screenshot.

This pull requests fixes this issue by simply removing the application of the str function before subsetting the enum member. This is also what is done in the IPython repo here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant