Browse Source

[debugger] synonym=>shortcut, added shortcut for backtrace (as in gdb), simplify regexp

Fedor Indutny 13 years ago
parent
commit
3a7713ff10
  1. 9
      lib/_debugger.js

9
lib/_debugger.js

@ -633,7 +633,7 @@ function SourceUnderline(sourceText, position) {
// Colourize char if stdout supports colours // Colourize char if stdout supports colours
if (process.stdout.isTTY) { if (process.stdout.isTTY) {
tail = tail.replace(/(.{1,}?)([^\w]|$)/, '\033[32m$1\033[39m$2'); tail = tail.replace(/(.+?)([^\w]|$)/, '\033[32m$1\033[39m$2');
} }
// Return source line with coloured char at `position` // Return source line with coloured char at `position`
@ -689,12 +689,13 @@ function Interface() {
ignored = ['pause', 'resume', 'exitRepl', 'handleBreak', ignored = ['pause', 'resume', 'exitRepl', 'handleBreak',
'requireConnection', 'killChild', 'trySpawn', 'requireConnection', 'killChild', 'trySpawn',
'controlEval', 'debugEval', 'print', 'childPrint'], 'controlEval', 'debugEval', 'print', 'childPrint'],
synonym = { shortcut = {
'run': 'r', 'run': 'r',
'cont': 'c', 'cont': 'c',
'next': 'n', 'next': 'n',
'step': 's', 'step': 's',
'out': 'o' 'out': 'o',
'backtrace': 'bt'
}; };
function defineProperty(key, protoKey) { function defineProperty(key, protoKey) {
@ -712,7 +713,7 @@ function Interface() {
for (var i in proto) { for (var i in proto) {
if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) { if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) {
defineProperty(i, i); defineProperty(i, i);
if (synonym[i]) defineProperty(synonym[i], i); if (shortcut[i]) defineProperty(shortcut[i], i);
} }
} }

Loading…
Cancel
Save