highlight current script

pull/22966/head
Ryan Dahl 2010-12-23 10:32:34 -08:00
parent 080daf9ddd
commit 74cc021ec2
1 changed files with 9 additions and 3 deletions

View File

@ -121,6 +121,7 @@ function Client() {
this.currentFrame = 0; this.currentFrame = 0;
this.currentSourceLine = -1; this.currentSourceLine = -1;
this.currentSource = null;
// Note that 'Protocol' requires strings instead of Buffers. // Note that 'Protocol' requires strings instead of Buffers.
socket.setEncoding('utf8'); socket.setEncoding('utf8');
@ -350,13 +351,17 @@ function startInterface() {
term.prompt(); term.prompt();
}); });
} else if (cmd == 'scripts') { } else if (cmd == 'scripts' || cmd == 'scripts full') {
c.reqScripts(function (res) { c.reqScripts(function (res) {
if (/full/.test(cmd)) { if (/full/.test(cmd)) {
console.log(res); console.log(res);
} else { } else {
var text = res.map(function (x) { return x.text; }); var text = '';
console.log(text.join('\n')); for (var i = 0; i < res.length; i++) {
text += res[i].name == c.currentScript ? '* ' : ' ';
text += res[i].name + '\n';
}
process.stdout.write(text);
} }
term.prompt(); term.prompt();
}); });
@ -435,6 +440,7 @@ function startInterface() {
c.currentSourceLine = res.body.sourceLine; c.currentSourceLine = res.body.sourceLine;
c.currentFrame = 0; c.currentFrame = 0;
c.currentScript = res.body.script.name;
console.log(result); console.log(result);