-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
1374212
d11ec11
5047de4
a7443e8
339b274
0c270b1
8cc60fa
21ee6eb
1e93c3b
1e8eae7
03a7462
4667ea4
e71fcf0
e4b4260
e280b14
bc20b5f
ccbc5c5
72a5a66
19ef391
a3b6135
239bf25
22f1f20
ede178a
c00c188
2dff7ca
37e6e6d
4bb11a9
652100f
ebb8167
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,9 @@ interface. | |||||||||||||||||||||
| key; it defaults to :kbd:`Tab`. If *completekey* is not :const:`None` and | ||||||||||||||||||||||
| :mod:`readline` is available, command completion is done automatically. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The string ``'tab'`` is treated specially: If the :mod:`readline` module | ||||||||||||||||||||||
| detects ``libedit``, it will be handled as ``'^I'`` for ``libedit``. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to me that this would be easier to explain after #112511 is merged:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @encukou Thank you for the clear explanation! |
||||||||||||||||||||||
| The optional arguments *stdin* and *stdout* specify the input and output file | ||||||||||||||||||||||
| objects that the Cmd instance or subclass instance will use for input and | ||||||||||||||||||||||
| output. If not specified, they will default to :data:`sys.stdin` and | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,13 @@ def cmdloop(self, intro=None): | |
| import readline | ||
| self.old_completer = readline.get_completer() | ||
| readline.set_completer(self.complete) | ||
| readline.parse_and_bind(self.completekey+": complete") | ||
| if 'libedit' in getattr(readline, '__doc__', ''): | ||
|
||
| if self.completekey == 'tab': | ||
| self.completekey = r'"\t"' | ||
| readline.parse_and_bind("bind "+self.completekey+" rl_complete") | ||
Constantin1489 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else: | ||
| readline.parse_and_bind(self.completekey+": complete") | ||
|
|
||
| except ImportError: | ||
| pass | ||
| try: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Support tab completion in :mod:`cmd` for Libedit. | ||
Constantin1489 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.