Commit Graph

23 Commits

Author SHA1 Message Date
Conrad Irwin 76336c5780 Trap SIGINT on jruby by default 2011-11-22 09:07:31 -08:00
John Mair 6e92cff1f7 Display a warning when command name collides with a local/method.
Warnings can be turned on/off by setting Pry.config.collision_warning = true/false. Defaults to true
2011-11-17 16:00:46 +13:00
Ryan Fitzgerald 98a063019a add correct_indent option 2011-10-27 23:57:11 -07:00
Conrad Irwin 31a171628a Pre-declare config.exception_window_size 2011-10-16 18:18:08 -07:00
John Mair 8ca04c22df fixed some style issues; renamed Pry.config.indent to Pry.config.auto_indent 2011-10-09 00:40:55 +13:00
Yorick Peterse e9c2f383eb Pry now indents code similar to IRB.
Code is indented using the class Pry::Indent. This class uses an internal stack
that contains the indentation levels for each line of code. Certain keywords
such as "class" or "def" will add data to this stack so that the next line is
indented, other keywords such as "end" or "}" will remove data from the stack,
causing the next line to be un-indented.

Pry::Indent is hooked into Pry#retrieve_line as well as Pry#readline. This means
that both input strings as well as the ones displayed by "show-method" are
indented. Sadly due to the way Readline works input strings are indented similar
to IRB. This means that instead of the following:

    > class User
    >   def initialize
    >   end
    > end

You'll get the following:

    > class User
    >   def initialize
    >     end
    >   end

While annoying there doesn't seem to be a way to work around this issue. Luckily
the "show-method" command indents your code properly.

By default indentation is turned on. This can be turned off (or back on) using
the configuration item Pry.config.indent. However, if you turn this option off
after a method is defined "show-method" will still show it with indentation as
indentation happens on input rather than only when code is displayed.

For more information see Pry::Indent#indent in lib/pry/indent.rb.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
2011-10-05 19:04:44 +02:00
Conrad Irwin aaf0cac06b Add a global exception whitelist (Issue 235) 2011-09-19 10:37:50 +08:00
John Mair 8f6878e0e3 now passing output object and pry instance into Pry.config.system proc 2011-09-18 00:42:29 +12:00
John Mair 66c464bafe system is now determined by a proc, Pry.config.system 2011-09-17 18:35:17 +12:00
John Mair 5a274b26df added input_stack support to Pry
input_stack allows Pry instances to seemlessly continue reading input from other input objects on the stack when the current object generates EOF
Useful when you need to temporarily divert reading to another object and then switch back to another object
2011-09-15 21:10:37 +12:00
John Mair 7509f6b6c1 Pry.editor -> Pry.config.editor 2011-08-30 03:00:13 +12:00
John Mair 3e137e8b1b added Pry.config.control_d_handler and also changed way control d (^D) works inside multi-line expressions (it clears input buffer) 2011-08-30 02:22:58 +12:00
John Mair b8847e538b removed unused results_pager config option 2011-07-27 05:16:07 +12:00
Ryan Fitzgerald 7ece261723 implement command_prefix feature 2011-07-26 00:34:54 -07:00
Ryan Fitzgerald 3b955809ca add config to disable auto-reload 2011-07-24 23:11:57 -07:00
Ryan Fitzgerald c8845bffb4 defer loading of requires specified on the command line 2011-07-24 20:13:18 -07:00
John Mair 3c7a1c2eca save before computer crash 2011-06-11 22:44:30 +12:00
David Palm 34f85aa3a9 Changing Pry.config.history.load/save into should_load/should_save to work aroung ActiveSupport 3.1.rc2 hijacking "load"
Changing test_pry.rb to require 'helper' using absolute path, so we can run tests under 1.9.2+
2011-06-09 12:25:06 +02:00
Mon ouïe b96f00cebd Allowed size of history arrays to be set in Pry.config 2011-06-05 18:37:54 +02:00
John Mair 94a1f993e6 Replaced Pry.config.should_load_plugins with Pry.config.plugins.enabled. Also added Pry.config.plugins.strict_loading config option; also updated test helper to reflect changes 2011-06-02 21:41:56 +12:00
John Mair 7bc03759d9 defining history config option directly in Config class and documenting it 2011-05-30 03:47:48 +12:00
John Mair e1d9763c28 Implemented readline history saving (~/.pry_history file by default) along with a bunch of options on `Pry.config.history` . Migrating more options over to Pry.config object. 2011-05-29 00:01:15 +12:00
John Mair e6c05a32d3 added config.rb to repo 2011-05-28 20:43:32 +12:00