Show More
@@ -393,8 +393,15 b' class InteractiveShell(SingletonConfigurable):' | |||||
393 | '"\e[B": history-search-forward', |
|
393 | '"\e[B": history-search-forward', | |
394 | '"\C-k": kill-line', |
|
394 | '"\C-k": kill-line', | |
395 | '"\C-u": unix-line-discard', |
|
395 | '"\C-u": unix-line-discard', | |
396 |
] |
|
396 | ], config=True) | |
397 |
|
397 | |||
|
398 | _custom_readline_config = False | |||
|
399 | ||||
|
400 | def _readline_parse_and_bind_changed(self, name, old, new): | |||
|
401 | # notice that readline config is customized | |||
|
402 | # indicates that it should have higher priority than inputrc | |||
|
403 | self._custom_readline_config = True | |||
|
404 | ||||
398 | ast_node_interactivity = Enum(['all', 'last', 'last_expr', 'none'], |
|
405 | ast_node_interactivity = Enum(['all', 'last', 'last_expr', 'none'], | |
399 | default_value='last_expr', config=True, |
|
406 | default_value='last_expr', config=True, | |
400 | help=""" |
|
407 | help=""" | |
@@ -1877,6 +1884,17 b' class InteractiveShell(SingletonConfigurable):' | |||||
1877 | else: |
|
1884 | else: | |
1878 | self.readline_startup_hook = readline.set_startup_hook |
|
1885 | self.readline_startup_hook = readline.set_startup_hook | |
1879 |
|
1886 | |||
|
1887 | # Readline config order: | |||
|
1888 | # - IPython config (default value) | |||
|
1889 | # - custom inputrc | |||
|
1890 | # - IPython config (user customized) | |||
|
1891 | ||||
|
1892 | # load IPython config before inputrc if default | |||
|
1893 | # skip if libedit because parse_and_bind syntax is different | |||
|
1894 | if not self._custom_readline_config and not readline.uses_libedit: | |||
|
1895 | for rlcommand in self.readline_parse_and_bind: | |||
|
1896 | readline.parse_and_bind(rlcommand) | |||
|
1897 | ||||
1880 | # Load user's initrc file (readline config) |
|
1898 | # Load user's initrc file (readline config) | |
1881 | # Or if libedit is used, load editrc. |
|
1899 | # Or if libedit is used, load editrc. | |
1882 | inputrc_name = os.environ.get('INPUTRC') |
|
1900 | inputrc_name = os.environ.get('INPUTRC') | |
@@ -1891,14 +1909,10 b' class InteractiveShell(SingletonConfigurable):' | |||||
1891 | except: |
|
1909 | except: | |
1892 | warn('Problems reading readline initialization file <%s>' |
|
1910 | warn('Problems reading readline initialization file <%s>' | |
1893 | % inputrc_name) |
|
1911 | % inputrc_name) | |
1894 |
|
1912 | |||
1895 | # Configure readline according to user's prefs |
|
1913 | # load IPython config after inputrc if user has customized | |
1896 | # This is only done if GNU readline is being used. If libedit |
|
1914 | if self._custom_readline_config: | |
1897 | # is being used (as on Leopard) the readline config is |
|
|||
1898 | # not run as the syntax for libedit is different. |
|
|||
1899 | if not readline.uses_libedit: |
|
|||
1900 | for rlcommand in self.readline_parse_and_bind: |
|
1915 | for rlcommand in self.readline_parse_and_bind: | |
1901 | #print "loading rl:",rlcommand # dbg |
|
|||
1902 | readline.parse_and_bind(rlcommand) |
|
1916 | readline.parse_and_bind(rlcommand) | |
1903 |
|
1917 | |||
1904 | # Remove some chars from the delimiters list. If we encounter |
|
1918 | # Remove some chars from the delimiters list. If we encounter |
General Comments 0
You need to be logged in to leave comments.
Login now