[debugger] synonym=>shortcut, added shortcut for backtrace (as in gdb), simplify...
authorFedor Indutny <fedor.indutny@gmail.com>
Wed, 14 Sep 2011 08:08:46 +0000 (15:08 +0700)
committerFedor Indutny <fedor.indutny@gmail.com>
Wed, 14 Sep 2011 16:05:04 +0000 (23:05 +0700)
lib/_debugger.js

index 8424848..a15a176 100644 (file)
@@ -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);
     }
   }