Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Restore Pry visibility after each evaluation. (Closes #344)

  • Loading branch information...
commit 351a1cf2b19a348c256255f6a7da79bf6bca9c4d 1 parent 09737ff
@netzpirat netzpirat authored
Showing with 20 additions and 3 deletions.
  1. +8 −0 CHANGELOG.md
  2. +12 −3 lib/guard/interactor.rb
View
8 CHANGELOG.md
@@ -1,3 +1,9 @@
+## Master
+
+### Improvements
+
+- [#344][] Restore Pry visibility after each evaluation. (reported by [@rking][], fixed by [@netzpirat][])
+
## 1.6.0 - 21 December, 2012
### New features
@@ -675,6 +681,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
[#334]: https://github.com/guard/guard/issues/334
[#342]: https://github.com/guard/guard/issues/342
[#343]: https://github.com/guard/guard/issues/343
+[#344]: https://github.com/guard/guard/issues/344
[#345]: https://github.com/guard/guard/issues/345
[#348]: https://github.com/guard/guard/issues/348
[#351]: https://github.com/guard/guard/issues/351
@@ -753,6 +760,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
[@pcreux]: https://github.com/pcreux
[@philomory]: https://github.com/philomory
[@pirukire]: https://github.com/pirukire
+[@rking]: https://github.com/rking
[@rmm5t]: https://github.com/rmm5t
[@royvandewater]: https://github.com/royvandewater
[@rudicode]: https://github.com/rudicode
View
15 lib/guard/interactor.rb
@@ -89,7 +89,7 @@ def initialize
Pry.config.should_load_local_rc = false
Pry.config.history.file = self.class.options[:history_file] || HISTORY_FILE
- load_guard_rc
+ add_hooks
create_run_all_command
create_command_aliases
@@ -99,12 +99,21 @@ def initialize
configure_prompt
end
- # Loads the `~/.guardrc` file when pry has started.
+ # Add Pry hooks:
#
- def load_guard_rc
+ # * Load `~/.guardrc` within each new Pry session.
+ # * Restore prompt after each evaluation.
+ #
+ def add_hooks
Pry.config.hooks.add_hook :when_started, :load_guard_rc do
load GUARD_RC if File.exist?(File.expand_path(self.class.options[:guard_rc] || GUARD_RC))
end
+
+ if stty_exists?
+ Pry.config.hooks.add_hook :after_eval, :restore_visibility do
+ system('stty echo')
+ end
+ end
end
# Creates a command that triggers the `:run_all` action
Please sign in to comment.
Something went wrong with that request. Please try again.