##// END OF EJS Templates
Take Brian comments into account
Matthias Bussonnier -
Show More
@@ -233,24 +233,24 b' For more information on filters and what you can do with the ``event`` object,'
233 Enter to execute
233 Enter to execute
234 ----------------
234 ----------------
235
235
236 In the Terminal IPython shell – which by default use the ``prompt_toolkit``
236 In the Terminal IPython shell – which by default uses the ``prompt_toolkit``
237 interface, the semantic of pressing the :kbd:`Enter` key can be ambiguous, in
237 interface, the semantic meaning of pressing the :kbd:`Enter` key can be
238 some case :kbd:`Enter` should execute code, and in others it should add a new
238 ambiguous. In some case :kbd:`Enter` should execute code, and in others it
239 line. IPython is using some heuristics to decide whether to execute or insert a
239 should add a new line. IPython uses heuristics to decide whether to execute or
240 new line at cursor position. For example, if we detect that the current code is
240 insert a new line at cursor position. For example, if we detect that the current
241 not valid Python, then the user is likely editing code and the right behavior is
241 code is not valid Python, then the user is likely editing code and the right
242 to likely to insert a new line. If the current code is a simple statement like
242 behavior is to likely to insert a new line. If the current code is a simple
243 `ord('*')`, then the right behavior is likely to execute. Though the exact
243 statement like `ord('*')`, then the right behavior is likely to execute. Though
244 desired semantics often varies from users to users.
244 the exact desired semantics often varies from users to users.
245
245
246 As the exact behavior of :kbd:`Enter` is subject to disagreement, it has been
246 As the exact behavior of :kbd:`Enter` is is ambiguous, it has been special cased
247 special cased in order for users to completely configure the behavior they like.
247 to allow users to completely configure the behavior they like. Hence you can
248 Hence you can have enter to simply alway execute code, if you prefer more fancy
248 have enter always execute code. If you prefer fancier behavior, you need to get
249 behavior : start your coffee machine on even days of odd month. You'll have to
249 your hands dirty and read the ``prompt_toolkit`` and IPython documentation
250 get your hands dirty and read prompt_toolkit and IPython documentation though.
250 though. See :ghpull:`10500`, set the
251 See :ghpull:`10500`, set the `c.TerminalInteractiveShell.handle_return` option
251 ``c.TerminalInteractiveShell.handle_return`` option and get inspiration from the
252 and get inspiration from the following example that insert new lines only after
252 following example that insert new lines only after a pipe (``|``). Place the
253 a pipe (``|``). Place the following in your configuration to do so::
253 following in your configuration to do so::
254
254
255 def new_line_after_pipe(shell):
255 def new_line_after_pipe(shell):
256 # shell is the same as get_ipython()
256 # shell is the same as get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now