code: function posToLine(pos, src) {
      if (pos >= src.length) {
          pos = src.length - 1;
      }
  
      if (pos <= -1) {
          return -1;
      }
  
      let line = 1;
      for (let i = 0; i < pos; i++) {
          if (src[i] === "\n") {
              ++line;
          }
      }
  
      return line;
  }
docs: O(srclength) so should only be used for debugging purposes, else replace with lut