summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-11-28 06:23:23 (GMT)
committerGitHub <noreply@github.com>2023-11-28 06:23:23 (GMT)
commit2df26d83486b8f9ac6b7df2a9a4669508aa61983 (patch)
tree1dbbc29f644f44dd7881427bfbac5294ac2da57c /Modules
parentac4b44266d61651aea5928ce7d3fae4de226f83d (diff)
downloadcpython-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.c16
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);