##// END OF EJS Templates
Merge pull request #9360 from takluyver/i9359...
Thomas Kluyver -
r22203:bad8a12c merge
parent child Browse files
Show More
@@ -9,7 +9,7 b' from IPython.core.interactiveshell import InteractiveShell'
9 from IPython.utils.py3compat import PY3, cast_unicode_py2, input
9 from IPython.utils.py3compat import PY3, cast_unicode_py2, input
10 from IPython.utils.terminal import toggle_set_term_title, set_term_title
10 from IPython.utils.terminal import toggle_set_term_title, set_term_title
11 from IPython.utils.process import abbrev_cwd
11 from IPython.utils.process import abbrev_cwd
12 from traitlets import Bool, Unicode, Dict
12 from traitlets import Bool, CBool, Unicode, Dict
13
13
14 from prompt_toolkit.completion import Completer, Completion
14 from prompt_toolkit.completion import Completer, Completion
15 from prompt_toolkit.enums import DEFAULT_BUFFER
15 from prompt_toolkit.enums import DEFAULT_BUFFER
@@ -72,6 +72,12 b' class TerminalInteractiveShell(InteractiveShell):'
72
72
73 pt_cli = None
73 pt_cli = None
74
74
75 confirm_exit = CBool(True, config=True,
76 help="""
77 Set to confirm when you try to exit IPython with an EOF (Control-D
78 in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit',
79 you can force a direct exit without any confirmation.""",
80 )
75 vi_mode = Bool(False, config=True,
81 vi_mode = Bool(False, config=True,
76 help="Use vi style keybindings at the prompt",
82 help="Use vi style keybindings at the prompt",
77 )
83 )
@@ -282,7 +288,8 b' class TerminalInteractiveShell(InteractiveShell):'
282 try:
288 try:
283 code = self.prompt_for_code()
289 code = self.prompt_for_code()
284 except EOFError:
290 except EOFError:
285 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
291 if (not self.confirm_exit) \
292 or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
286 self.ask_exit()
293 self.ask_exit()
287
294
288 else:
295 else:
General Comments 0
You need to be logged in to leave comments. Login now