You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't really know how to explain a full reproducer for this because it depends on the history of things that I have typed into ipython. Right now I can reproduce this as follows but I am not sure what previous things I have done that cause this to happen.
First just setup a few pieces:
In [4]: solve=lambda*a, **kw: NoneIn [5]: syms=E=None
Now I run this command:
In [6]: solve(E, syms)
Now I want to rerun this but change it to solve(groebner(E), syms) so I follow these steps carefully:
Push <up>, then <home> then <right> 6 times and type groebner(. Now I have this:
In [7]: solve(groebner(E, syms)
and my cursor is flashing on the E.
I want to add the closing bracket ) after the E so I press <right> and then something weird happens:
In [7]: solve(groebner(, syms, dict=True)E, syms)
Somehow pressing <right> inserted the text , syms, dict=True) and then left my cursor at the end of that text.
Is this a bug? Have I perhaps somehow accidentally configured something that makes this happen?
Adding the text , syms, dict=True) is certainly something that I have previously done as an edit so maybe ipython "remembers" that somehow?
Note that if I change anything about this like if I delete the s from the start of the line then it does not happen. Somehow this is specific to the exact text that I am editing e.g. if I have this then I can use both <left> and <right> normally:
In [7]: olve(groebner(E, syms)
I think it is trying to complete from the history somehow e.g. if I have this:
In [7]: solve(groebner(E, syms),
then the completer offers:
It seems that the completion is being used when the cursor is not at the end of the line somehow.
Running into the same issue on WSL2 / Windows 10. Pretty strange behavior that right arrow at some random points triggers auto-completion mid line, while the expected behavior is to only complete when the cursor's on the end character and a suggestion is shown. Has anyone been trying to look at this or try to replicate it?
Python Version: 3.10.12
IPython Version: 8.7.12
Enter 123 in, press Enter. Then write down 2. Press Left. Type 1 (in front of the 2). Press right arrow key. A 3 is autocompleted and it results in 132.
Thanks, I can reproduce it with that as well. I guess it sees that 12 can be completed to 123 and so inserts 3 but the cursor is in the wrong position.
It only happens if the cursor is not at the end of the line when you add the 1 so that the match occurs while the cursor is in the wrong position.
Same problem!
I wish it would be possible to disable auto completion while the cursor is not at the end, if there is no other particular reason to allow this. I think this is where the problem lies.
Same here and driving me nuts, macOS 15.3 with ipython 8.32.0 and python 3.13.2. The only "fix" I've found is to set TerminalInteractiveShell.editing_mode=vi, hit ESC to enter normal mode, and use j/k to move left/right instead of the arrow keys, then hit i to enter insert mode when I get to the position I want edit. Using the right arrow key in vi insert mode still has this bug, so using vi normal mode for movement within the line is the only way to avoid it.
There has been a number of updates the autosuggestions, and completion in 9.0 (main), and I hve published a beta, I would appreciate for some of you to try,
but as I can't reproduce, I can't debug.
Please also check your prompt toolkit version; my hunch is that it's the autosuggestions, not the completions. It should not be triggered when not at end of line.
It occurs to me almost every time I write somefunction() then <left arrow>, <fill in the function arguments>, <right arrow> ... and attempt to continue typing the rest of the line, which is instead filled with autocompleted stuff (which is always wrong, as in the 123 -> 132 case).
This is often enough that ipython is unusable for me, and I have been using regular python since encountering this bug
I think I managed to reproduce, but that requires a bit more setup than what is described here,
for example it is likely that @oscarbenjamin you may have typed solve(groebner(E, syms), syms, dict=True) or something similar in the past ?
here is my attempt at reproducing, then trying a fix.
Well, it depends, I could make it to reproduce but I can make it do anything,
like for me 1000002
Do you not consider that to be a bug?
The behaviour I would expect here is that when the cursor is not at the end of the line the right arrow key always just moves the cursor and does not insert text or anything else. Any other behaviour means you lose the ability to navigate around the line using the left and right arrow keys.
Activity
codtiger commentedon Nov 20, 2023
Running into the same issue on WSL2 / Windows 10. Pretty strange behavior that right arrow at some random points triggers auto-completion mid line, while the expected behavior is to only complete when the cursor's on the end character and a suggestion is shown. Has anyone been trying to look at this or try to replicate it?
Python Version: 3.10.12
IPython Version: 8.7.12
iftekhart commentedon Mar 28, 2024
Reporting the same issue in ipython version 8.22.2
k4lizen commentedon Sep 5, 2024
repro:
Enter
123in, press Enter. Then write down2. Press Left. Type1(in front of the2). Press right arrow key. A3is autocompleted and it results in 132.oscarbenjamin commentedon Sep 5, 2024
Thanks, I can reproduce it with that as well. I guess it sees that
12can be completed to123and so inserts3but the cursor is in the wrong position.It only happens if the cursor is not at the end of the line when you add the
1so that the match occurs while the cursor is in the wrong position.t4rf9 commentedon Dec 31, 2024
Same problem!
I wish it would be possible to disable auto completion while the cursor is not at the end, if there is no other particular reason to allow this. I think this is where the problem lies.
captnjameskirk commentedon Feb 17, 2025
Same here and driving me nuts, macOS 15.3 with ipython 8.32.0 and python 3.13.2. The only "fix" I've found is to set
TerminalInteractiveShell.editing_mode=vi, hit ESC to enter normal mode, and use j/k to move left/right instead of the arrow keys, then hit i to enter insert mode when I get to the position I want edit. Using the right arrow key in vi insert mode still has this bug, so using vi normal mode for movement within the line is the only way to avoid it.Carreau commentedon Feb 26, 2025
There has been a number of updates the autosuggestions, and completion in 9.0 (main), and I hve published a beta, I would appreciate for some of you to try,
but as I can't reproduce, I can't debug.
Please also check your prompt toolkit version; my hunch is that it's the autosuggestions, not the completions. It should not be triggered when not at end of line.
k4lizen commentedon Mar 6, 2025
@Carreau
I can reproduce on main (a6a4b0a)
how?
k4lizen commentedon Mar 6, 2025
It occurs to me almost every time I write
somefunction()then<left arrow>,<fill in the function arguments>,<right arrow>... and attempt to continue typing the rest of the line, which is instead filled with autocompleted stuff (which is always wrong, as in the 123 -> 132 case).This is often enough that ipython is unusable for me, and I have been using regular python since encountering this bug
Fix accept invisible completions
Carreau commentedon Mar 6, 2025
Could you try #14823 ?
I think I managed to reproduce, but that requires a bit more setup than what is described here,
for example it is likely that @oscarbenjamin you may have typed
solve(groebner(E, syms), syms, dict=True)or something similar in the past ?here is my attempt at reproducing, then trying a fix.
Screen.Recording.2025-03-06.at.16.33.24.mov
k4lizen commentedon Mar 6, 2025
My prompt toolkit version is
3.0.50. The 123 reproducer #14137 (comment) doesn't work for you?I can confirm your branch fixes the issue for me. Awesome :D
Carreau commentedon Mar 6, 2025
Well, it depends, I could make it to reproduce but I can make it do anything,
like for me
1000002Untitled.2.mov
oscarbenjamin commentedon Mar 6, 2025
Do you not consider that to be a bug?
The behaviour I would expect here is that when the cursor is not at the end of the line the right arrow key always just moves the cursor and does not insert text or anything else. Any other behaviour means you lose the ability to navigate around the line using the left and right arrow keys.
Carreau commentedon Mar 6, 2025
Yeah I consider it a bug (hence the PR to fix it that needs more test).
Fix accept invisible completions (#14823)
Carreau commentedon Mar 8, 2025
closed by #14823
oscarbenjamin commentedon Mar 8, 2025
Thanks!