Compare commits
13 Commits
64e5c8bd93
...
cd1761e44d
Author | SHA1 | Date |
---|---|---|
|
cd1761e44d | |
|
b12fff99c3 | |
|
89e7a807f4 | |
|
44f19be7cb | |
|
5e7e6b4085 | |
|
d43019f19c | |
|
cfd23788f1 | |
|
c0774628bf | |
|
a44a6dca06 | |
|
4fdae0fcdf | |
|
ee88e3c1e8 | |
|
b348c58238 | |
|
ce537bc010 |
|
@ -41,3 +41,38 @@ from .pformat import (
|
||||||
pformat_caller_frame as pformat_caller_frame,
|
pformat_caller_frame as pformat_caller_frame,
|
||||||
pformat_boxed_tb as pformat_boxed_tb,
|
pformat_boxed_tb as pformat_boxed_tb,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _enable_readline_feats() -> str:
|
||||||
|
'''
|
||||||
|
Handle `readline` when compiled with `libedit` to avoid breaking
|
||||||
|
tab completion in `pdbp` (and its dep `tabcompleter`)
|
||||||
|
particularly since `uv` cpython distis are compiled this way..
|
||||||
|
|
||||||
|
See docs for deats,
|
||||||
|
https://docs.python.org/3/library/readline.html#module-readline
|
||||||
|
|
||||||
|
Originally discovered soln via SO answer,
|
||||||
|
https://stackoverflow.com/q/49287102
|
||||||
|
|
||||||
|
'''
|
||||||
|
import readline
|
||||||
|
if (
|
||||||
|
# 3.13+ attr
|
||||||
|
# https://docs.python.org/3/library/readline.html#readline.backend
|
||||||
|
(getattr(readline, 'backend', False) == 'libedit')
|
||||||
|
or
|
||||||
|
'libedit' in readline.__doc__
|
||||||
|
):
|
||||||
|
readline.parse_and_bind("python:bind -v")
|
||||||
|
readline.parse_and_bind("python:bind ^I rl_complete")
|
||||||
|
return 'libedit'
|
||||||
|
else:
|
||||||
|
readline.parse_and_bind("tab: complete")
|
||||||
|
readline.parse_and_bind("set editing-mode vi")
|
||||||
|
readline.parse_and_bind("set keymap vi")
|
||||||
|
return 'readline'
|
||||||
|
|
||||||
|
|
||||||
|
# TODO, move this to a new `.devx._pdbp` mod?
|
||||||
|
_enable_readline_feats()
|
||||||
|
|
Loading…
Reference in New Issue