mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
gh-102130: Support tab completion in cmd for Libedit. (GH-107748)
--- Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
This commit is contained in:
parent
dc824c5dc1
commit
aa5bee30ab
5 changed files with 51 additions and 1 deletions
10
Lib/cmd.py
10
Lib/cmd.py
|
@ -108,7 +108,15 @@ class Cmd:
|
|||
import readline
|
||||
self.old_completer = readline.get_completer()
|
||||
readline.set_completer(self.complete)
|
||||
readline.parse_and_bind(self.completekey+": complete")
|
||||
if readline.backend == "editline":
|
||||
if self.completekey == 'tab':
|
||||
# libedit uses "^I" instead of "tab"
|
||||
command_string = "bind ^I rl_complete"
|
||||
else:
|
||||
command_string = f"bind {self.completekey} rl_complete"
|
||||
else:
|
||||
command_string = f"{self.completekey}: complete"
|
||||
readline.parse_and_bind(command_string)
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue