From 3a7713ff10d69aa462c325ae65f806de3d234ce4 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Wed, 14 Sep 2011 15:08:46 +0700 Subject: [PATCH] [debugger] synonym=>shortcut, added shortcut for backtrace (as in gdb), simplify regexp --- lib/_debugger.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index 84248487f7b..a15a17610fe 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -633,7 +633,7 @@ function SourceUnderline(sourceText, position) { // Colourize char if stdout supports colours 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` @@ -689,12 +689,13 @@ function Interface() { ignored = ['pause', 'resume', 'exitRepl', 'handleBreak', 'requireConnection', 'killChild', 'trySpawn', 'controlEval', 'debugEval', 'print', 'childPrint'], - synonym = { + shortcut = { 'run': 'r', 'cont': 'c', 'next': 'n', 'step': 's', - 'out': 'o' + 'out': 'o', + 'backtrace': 'bt' }; function defineProperty(key, protoKey) { @@ -712,7 +713,7 @@ function Interface() { for (var i in proto) { if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) { defineProperty(i, i); - if (synonym[i]) defineProperty(synonym[i], i); + if (shortcut[i]) defineProperty(shortcut[i], i); } }