From 5f20c5c46aed410df917f0588818fe9d6a92413b Mon Sep 17 00:00:00 2001 From: MrBrdo Date: Sun, 10 Jun 2012 23:41:09 +0200 Subject: [PATCH] support array of trigger keys --- lib/rack/webconsole/repl.rb | 6 +++++- public/webconsole.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rack/webconsole/repl.rb b/lib/rack/webconsole/repl.rb index 1154762..3697420 100644 --- a/lib/rack/webconsole/repl.rb +++ b/lib/rack/webconsole/repl.rb @@ -78,7 +78,11 @@ def call(env) pry = $pry # repl loop - target = Pry.binding_for(pry.binding_stack.last || TOPLEVEL_BINDING) + if pry.binding_stack.last + target = Pry.binding_for(pry.binding_stack.last) + else + target = Pry.binding_for(TOPLEVEL_BINDING) + end pry.repl_prologue(target) unless pry.binding_stack.last == target pry.inject_sticky_locals(target) code = params['query'] diff --git a/public/webconsole.js b/public/webconsole.js index 997c25d..aed9718 100644 --- a/public/webconsole.js +++ b/public/webconsole.js @@ -151,7 +151,7 @@ $(document).ready(function() { $(this).keypress(function(event) { - if (event.which == $KEY_CODE) { + if ($KEY_CODE.indexOf(event.which) >= 0) { $("#rack-webconsole").slideToggle('fast', function() { if ($(this).is(':visible')) { $("#rack-webconsole form input").focus();