Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-102130: Support tab completion in cmd for Libedit.#107748
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bedevere-bot commentedAug 7, 2023
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
Constantin1489 commentedAug 7, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There is something that Python core developers decide.
OR just If this is supported, then other third-party libraries can support Libedit tab completion without changing their code.
Because of the absence of the GNU inputrc example in For Vim keybinding in the editrc example(
Just so you know, if you want to debug this problem, please check what I found below. Use one of these lines to enable tab completion in Python using To use them with The key sequences( But the last two lines are not. I stumble across them. To do another complete command in Libedit, this is possible. I found several ways to debug it. (these are examples.)
How to check the keybinding setting applied with Libedit. This shows the user's current applied libedit readline setting. |
Uh oh!
There was an error while loading.Please reload this page.
gaogaotiantian commentedNov 3, 2023
I don't think we should change the default and hope the completekey passed in is correct. It could break users code, for example, if they compare classMyCmd(cmd.Cmd):def__init__(self,completekey='tab'):cmd.Cmd.__init__(self,completekey) They will still have the issue. We should convert the completekey internally and just do a different binding command with Also, why do you want to change the I believe the right way to do this is just add an extra check in Also, if you want to finish this, you'd need a regression test on at least I can help you with the review and find the core-dev for approval if you want to work on this. |
Constantin1489 commentedNov 5, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yes, what you pointed is valid.
Because I was unsure about the decision I made. This is what I asked in number 1#107748 (comment). At the time I wrote this PR, I thought, that if a user did something wrong, the wrong result must be thrown. And the docs must give a pledge. (You know when learning the linux thing there must be some reason I don't know and some result is unintuitive or counterintuitive for newcomer.). Thank you for giving me direction for what I consider. I will do that within a week as soon as possible. The second thing you mention(site.py) is just for a tone and manner thing(second and third thing that I asked in#107748 (comment)). I will revert it. Thank you for helping me. |
gaogaotiantian commentedNov 5, 2023
I believe you only need to change BTW, you should not use |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
This comment was marked as resolved.
This comment was marked as resolved.
gaogaotiantian commentedNov 7, 2023
I have the hardest time believing that commit can cause the completion issue. The code should not be executed at all for completion. Are you sure you did the test correctly? |
Constantin1489 commentedNov 7, 2023
I'm sorry. You are right. Maybe my environment goes something wrong. |
gaogaotiantian commentedNov 13, 2023
Hi@Constantin1489 , now that#111826 is merged, you have the utility to write tests for the feature. Could you:
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
encukou commentedDec 1, 2023
And one more thing I always forget to point out (sorry for that)! At the end of the Also, please ignore the free-threaded CI failures; they're not your fault and they're allowed to fail for now. |
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2023-08-07-21-11-24.gh-issue-102130._UyI5i.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
encukou commentedDec 1, 2023 via email
change the NEWS text, the commit names don't matter On December 1, 2023 5:02:04 PM GMT+01:00, Constantin Hong ***@***.***> wrote:@Constantin1489 commented on this pull request.> @@ -0,0 +1 @@+Support tab completion in :mod:`cmd` for Libedit.Should I change Libedit to editline of this and this commit post's name?```gh-102130: Support tab completion in cmd for Libedit.->gh-102130: Support tab completion in cmd for editline.```--Reply to this email directly or view it on GitHub:#107748 (review)You are receiving this because you were mentioned.Message ID: ***@***.***> -- Sent from my Android device with K-9 Mail. Please excuse my brevity. |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
bedevere-bot commentedDec 4, 2023
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou commentedDec 5, 2023
Thank you for your contribution! |
…-107748)---Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
…-107748)---Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
tanloong commentedOct 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@gaogaotiantian, as libedit is now supported, is this part in Can I make a PR to remove it? |
gaogaotiantian commentedOct 25, 2025
@tanloong, I don't believe you can. If you read the full discussion (to be more specific -#107748 (comment)), you'll find that we tried to do that but failed. The problem is |
tanloong commentedOct 26, 2025
@gaogaotiantian, thanks so much for clarifying, I totally missed it from not reading carefully. I want to be honest I'm not sure if I can fix the libedit space issue, but I'll still give it a try. Thanks again! |
Uh oh!
There was an error while loading.Please reload this page.
After I dug the rabbit hole, I wanted to share something and commit it to CPython.
My commit allows tab completion in cmd for Libedit. (EDIT AFTER MERGE: this allows tab completion for pdb with libedit)
tabofreadline.parse_and_bind("tab: complete")is a symbolic character name. Libedit doesn't support a number of symbolic character names(like TAB, ESC, DEL).FYI, for better compatibility, Python Documents should suggest using backslashed escape sequences(e.g.
\t,\a) or the ASCII character corresponding to the octal number(or octal excape sequences).(e.g.\011), It's because the only thing GNU readline(man bashand/Readline Key Bindingsto search the part.) and Libedit(man editrc) have in common.Also, unlike GNU emacs software, GNU readline doesn't support control characters of the form '^character' (e.g. '^I' it's a tab).
Both GNU readline(
man bashand/Readline Key Bindingsto search the part.) and Libedit(man editrc) support the following backslashed escape sequences and octal escape sequences.GNU readline's predefined commands are in the '/Readline Command Names' of
man bash.Libedit's predefined commands are in the section "EDITOR COMMANDS" of
man editrc. But there are other undocumented commands in its source code.Or you can get a list by
import readline; readline.parse_and_bind('bind -l')(Libedit only. This shows undocumented commands too).📚 Documentation preview 📚:https://cpython-previews--107748.org.readthedocs.build/