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

IPython copy bug while vi mode #14400

Open
kalocsaibotond opened this issue Apr 12, 2024 · 2 comments
Open

IPython copy bug while vi mode #14400

kalocsaibotond opened this issue Apr 12, 2024 · 2 comments

Comments

@kalocsaibotond
Copy link

kalocsaibotond commented Apr 12, 2024

I launched IPython in vi mode, using the --TerminalInteractiveShell.editing_mode=vi flag, and copied large chunks of code (whole file) for testing a bug, that occured when I pasted the code. When the pasting occurs, a character is cut out from the pasted string and then placed at the end of the pasted string. The choice of the character is seemingly random, but it ruins the code more often than not@. This happens for whole file copy. If copy a segment of the file then only the character appears. It is very confusing.

I was using:

  • Windows 10
  • IPython 8.20.0
  • Python 3.11.7
  • WezTerm 20240203-110809-5046fc22
  • I copied from Neovim 0.9.5 into IPython console on a pane.
@ivanov
Copy link
Member

ivanov commented Sep 27, 2024

@kalocsaibotond can you please provide a standalone reproducible example of this behavior, so we can verify if this affects other platform. It'd be great if you could also try out a different terminal emulator, so we could rule that out.

@kalocsaibotond
Copy link
Author

I launched ipython --TerminalInteractiveShell.editing_mode=vi, pasted the code at https://matplotlib.org/stable/_downloads/3e1134ffd2662d0ad0c453c6dfb7882d/scatter_hist.py from the browser, put the cursor at the end of the code and pressed enter.
The result in WezTerm:
Image
The result in Windows Terminal:
Image

In these cases the described bug manifests in randomly grabbing somewhere a t from the pasted code and inserting at the end. Since the code end with a comment, and the t is grabbed from a non-critical string or from a comment, in this case the code runs.
However in my private codes I encountered cases where the pasting process grabbed a character from the running code and inserted at the and, thus the code failed to run.

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

No branches or pull requests

2 participants