;(function(exports) {
  var codeAnalyzer;
  if(typeof module !== 'undefined' && module.exports) { // node
    codeAnalyzer = require('../src/code-analyzer').codeAnalyzer;
  } else { // browser
    codeAnalyzer = window.codeAnalyzer;
  }

  mapper = {
    // returns cell that text point is at
    getIndex: function(terminal, text, relativePoint) {
      var charDimes = terminal.getCharDimes();
      var point = offset(relativePoint, terminal.getOffset());
      for (var i = 0, x = 0, y = charDimes.y; i < text.length; i++) {
        if (codeAnalyzer.isAtNewline(text, i)) {
          y += charDimes.y;
          x = 0;
        } else  { // not reached end of line
          x += charDimes.x
        }

        if (point.x >= x - charDimes.x && point.x < x &&
            point.y >= y - charDimes.y && point.y < y) {
          return i;
        }
      }

      return undefined;
    },

    getLineNumber: function(terminal, text, relativePoint) {
      var charDimes = terminal.getCharDimes();
      var point = offset(relativePoint, terminal.getLineOffset());
      if (point.x < 0 || point.x >= terminal.getWidth()) {
        return undefined;
      }

      var lines = text.split("\n");
      for (var i = 0, y = charDimes.y; i < lines.length; i++) {
        if (point.y >= y - charDimes.y && point.y < y) {
          return i;
        }
        y += charDimes.y;
      }

      return undefined;
    }
  };

  var offset = function(point, offset) {
    return {
      x: point.x - offset.l,
      y: point.y - offset.t
    };
  };

  exports.mapper = mapper;
})(typeof exports === 'undefined' ? this : exports)

@@ -1055,24 +1055,25 @@
 eOffset());%0A
+%0A
       if (po
@@ -1396,24 +1396,190 @@
  undefined;%0A
+    %7D,%0A%0A    getLine: function(terminal, text, point) %7B%0A      var lineNumber = mapper.getLineNumber(terminal, text, point);%0A      return text.split(%22%5Cn%22)%5BlineNumber%5D;%0A
     %7D%0A  %7D;%0A%0A

Add handy getLine fn to mapper.