summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-18 03:48:32 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-18 03:48:32 (GMT)
commit52d1b4e62fd35e19d4f2c231fe48d463cb83d374 (patch)
tree7878321a91a145667bd978e7576f415dcc8b1f15 /Modules
parentc539a2a88ef54b4ecb1c3c769f31b6e8da361ad1 (diff)
downloadcpython-52d1b4e62fd35e19d4f2c231fe48d463cb83d374.zip
cpython-52d1b4e62fd35e19d4f2c231fe48d463cb83d374.tar.gz
cpython-52d1b4e62fd35e19d4f2c231fe48d463cb83d374.tar.bz2
#9907: call rl_initialize early when using editline on OSX
editline rl_initialize apparently discards any mappings done before it is called, which makes tab revert to file completion instead of inserting a tab. So now on OSX we call rl_initialize first if we are using readline, and then re-read the users .editrc (if any) afterward so they can still override our defaults. Patch by Ned Deily, modified by Ronald Oussoren.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/readline.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 466ec51..8337956 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -889,6 +889,14 @@ setup_readline(void)
Py_FatalError("not enough memory to save locale");
#endif
+#ifdef __APPLE__
+ /* the libedit readline emulation resets key bindings etc
+ * when calling rl_initialize. So call it upfront
+ */
+ if (using_libedit_emulation)
+ rl_initialize();
+#endif /* __APPLE__ */
+
using_history();
rl_readline_name = "python";
@@ -920,8 +928,13 @@ setup_readline(void)
* XXX: A bug in the readline-2.2 library causes a memory leak
* inside this function. Nothing we can do about it.
*/
- rl_initialize();
-
+#ifdef __APPLE__
+ if (using_libedit_emulation)
+ rl_read_init_file(NULL);
+ else
+#endif /* __APPLE__ */
+ rl_initialize();
+
RESTORE_LOCALE(saved_locale)
}