code: function getInputLine(n) {
      if (n===undefined) n=0;
      var startLine = termText.length-1;
      while (startLine>=0 && !(n==0 && termText[startLine].substr(0,1)==">")) {
        if (termText[startLine].substr(0,1)==">") n--;
        startLine--;
      }
      if (startLine<0) return undefined;
      var line = startLine;
      var text = termText[line++].substr(1);
      while (line < termText.length && termText[line].substr(0,1)==":")
        text += "\n"+termText[line++].substr(1);
      return { line : startLine, text : text };
    }
docs: Get the Nth from latest terminal line (and the line number of it). 0=current line.
  By terminal line we mean a line starting with '>'