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();