[debugger] separate history of control and debug, make scripts command getter

pull/22966/head
Fedor Indutny 2011-09-14 16:35:51 +07:00
parent 19194f87c5
commit 1dd3b68c4f
1 changed files with 17 additions and 3 deletions

View File

@ -735,6 +735,10 @@ function Interface() {
this.waiting = null; this.waiting = null;
this.paused = 0; this.paused = 0;
this.context = this.repl.context; this.context = this.repl.context;
this.history = {
debug: [],
control: []
};
}; };
@ -1015,11 +1019,12 @@ Interface.prototype.backtrace = function() {
// argument full tells if it should display internal node scripts or not // argument full tells if it should display internal node scripts or not
Interface.prototype.scripts = function(displayNatives) { Interface.prototype.scripts = function() {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var client = this.client; var client = this.client,
var scripts = []; displayNatives = arguments[0] || false,
scripts = [];
this.pause(); this.pause();
for (var id in client.scripts) { for (var id in client.scripts) {
@ -1228,6 +1233,10 @@ Interface.prototype.repl = function() {
this.repl.eval = this.debugEval.bind(this); this.repl.eval = this.debugEval.bind(this);
this.repl.context = {}; this.repl.context = {};
// Swap history
this.history.control = this.repl.rli.history;
this.repl.rli.history = this.history.debug;
this.repl.prompt = '> '; this.repl.prompt = '> ';
this.repl.rli.setPrompt('> '); this.repl.rli.setPrompt('> ');
this.repl.displayPrompt(); this.repl.displayPrompt();
@ -1236,8 +1245,13 @@ Interface.prototype.repl = function() {
// Exit debug repl // Exit debug repl
Interface.prototype.exitRepl = function() { Interface.prototype.exitRepl = function() {
// Restore eval
this.repl.eval = this.controlEval.bind(this); this.repl.eval = this.controlEval.bind(this);
// Swap history
this.history.debug = this.repl.rli.history;
this.repl.rli.history = this.history.control;
this.repl.context = this.context; this.repl.context = this.context;
this.repl.prompt = 'debug> '; this.repl.prompt = 'debug> ';
this.repl.rli.setPrompt('debug> '); this.repl.rli.setPrompt('debug> ');