summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-18 03:52:09 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-18 03:52:09 (GMT)
commit7a697251c9c202891325a4268a75b8efa9774acd (patch)
tree4484ea7a343c8acc9e71cb8f42c67ce249f6300f
parentaa7017f5f5d995ff25d1927edb75190b3bd381dc (diff)
downloadcpython-7a697251c9c202891325a4268a75b8efa9774acd.zip
cpython-7a697251c9c202891325a4268a75b8efa9774acd.tar.gz
cpython-7a697251c9c202891325a4268a75b8efa9774acd.tar.bz2
Merged revisions 87356 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87356 | r.david.murray | 2010-12-17 22:48:32 -0500 (Fri, 17 Dec 2010) | 11 lines #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. ........
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/readline.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 150dee8..8ca6dcf 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,6 +22,9 @@ Core and Builtins
Library
-------
+- Issue $9907: Fix tab handling on OSX when using editline by calling
+ rl_initialize first, then setting our custom defaults, then reading .editrc.
+
- Issue #4188: Avoid creating dummy thread objects when logging operations
from the threading module (with the internal verbose flag activated).
diff --git a/Modules/readline.c b/Modules/readline.c
index 0afba5d..b5e258d 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -865,6 +865,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";
@@ -896,8 +904,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)
}