diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2023-11-28 06:23:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-28 06:23:23 (GMT) |
commit | 2df26d83486b8f9ac6b7df2a9a4669508aa61983 (patch) | |
tree | 1dbbc29f644f44dd7881427bfbac5294ac2da57c /Modules | |
parent | ac4b44266d61651aea5928ce7d3fae4de226f83d (diff) | |
download | cpython-2df26d83486b8f9ac6b7df2a9a4669508aa61983.zip cpython-2df26d83486b8f9ac6b7df2a9a4669508aa61983.tar.gz cpython-2df26d83486b8f9ac6b7df2a9a4669508aa61983.tar.bz2 |
gh-112105: Make completer delims work on libedit (gh-112106)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/readline.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 209ac8b..eb9a3d4 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -592,6 +592,13 @@ readline_set_completer_delims(PyObject *module, PyObject *string) if (break_chars) { free(completer_word_break_characters); completer_word_break_characters = break_chars; +#ifdef WITH_EDITLINE + rl_basic_word_break_characters = break_chars; +#else + if (using_libedit_emulation) { + rl_basic_word_break_characters = break_chars; + } +#endif rl_completer_word_break_characters = break_chars; Py_RETURN_NONE; } @@ -1309,6 +1316,15 @@ setup_readline(readlinestate *mod_state) completer_word_break_characters = strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?"); /* All nonalphanums except '.' */ +#ifdef WITH_EDITLINE + // libedit uses rl_basic_word_break_characters instead of + // rl_completer_word_break_characters as complete delimiter + rl_basic_word_break_characters = completer_word_break_characters; +#else + if (using_libedit_emulation) { + rl_basic_word_break_characters = completer_word_break_characters; + } +#endif rl_completer_word_break_characters = completer_word_break_characters; mod_state->begidx = PyLong_FromLong(0L); |