<commit_before>// getLineTextGetter(match.file.map.css);

var Point = require('./points');

// THIS NEEDS TO BE ABLE TO CHECK MULTIPLE LINES
function normalizeTextRange(bufferLine, css) {
  // debugger;
  var line = Point.sourceLineToAtomLine(bufferLine);
  console.error(bufferLine, line);
  var arrayOfLines = css.match(/[^\r\n]+/g);
  // console.log(line);
  // console.log(arrayOfLines);
  var text = arrayOfLines[line];
  console.log(text);
  // window.x = arrayOfLines;
  // console.log(text, '||||', arrayOfLines[line + 1]);

  var len = text.length;
  text = text.replace(/^\s*/, ''); // remove leading whitespace --- does it need to check for linebreaks separately??
  var startColumn = len - text.length;
  text = text.replace(/\s*{?\s*$/, ''); // remove trailing whitespace + optional curly brace {
  var endColumn = startColumn + text.length;
  var range = makeNewRangeArray(bufferLine, startColumn, bufferLine, endColumn);

  return {
    range: range,
    text: text
  };
}

function normalizeTextRangez(bufferLine, css) {
  var line = Point.sourceLineToAtomLine(bufferLine);
  var arrayOfLines = css.match(/[^\r\n]+/g);

  var bufferLineText = arrayOfLines[line];

  var endColumn;
  var trimmed = '';
  var len = bufferLineText.length;
  // debugger;
  var lineText = bufferLineText.replace(/^\s*/, '');
  var startColumn = len - lineText.length;
  var offset = startColumn;
  var endLine = bufferLine;
  var text = lineText;

  var i = 0;

  while (true) {
    i++;
    endColumn = lineText.indexOf('{');
    if (endColumn === -1) {
      text += lineText;
    }
    else {
      trimmed = lineText.replace(/\s*{?\s*$/, ''); // why is { optional here?
      endColumn = offset + trimmed.length;
      text += trimmed;
      break;
    }

    offset = 0;
    lineText = getLineText(++endLine);
    if (i === 10) {
      console.error('NOT A GOOD');
      return;
    }
    i++;
  }

  var range = makeNewRangeArray(bufferLine, startColumn, endLine, endColumn);

  console.error({
    range: range,
    text: text
  });

  return {
    range: range,
    text: text
  };

}

function getLineTextGetter(css) {
  var arrayOfLines = css.match(/[^\r\n]+/g); // split on linebreaks<commit_msg>added untrimmedText placeholder to range-utils<commit_after>// getLineTextGetter(match.file.map.css);

var Point = require('./points');

// THIS NEEDS TO BE ABLE TO CHECK MULTIPLE LINES
function normalizeTextRange(bufferLine, css) {
  // debugger;
  var line = Point.sourceLineToAtomLine(bufferLine);
  console.error(bufferLine, line);
  var arrayOfLines = css.match(/[^\r\n]+/g);
  // console.log(line);
  // console.log(arrayOfLines);
  var text = arrayOfLines[line];
  console.log(text);
  // window.x = arrayOfLines;
  // console.log(text, '||||', arrayOfLines[line + 1]);

  var len = text.length;
  text = text.replace(/^\s*/, ''); // remove leading whitespace --- does it need to check for linebreaks separately??
  var startColumn = len - text.length;
  text = text.replace(/\s*{?\s*$/, ''); // remove trailing whitespace + optional curly brace {
  var endColumn = startColumn + text.length;
  var range = makeNewRangeArray(bufferLine, startColumn, bufferLine, endColumn);

  return {
    range: range,
    text: text
  };
}

function normalizeTextRangez(bufferLine, css) {
  var line = Point.sourceLineToAtomLine(bufferLine);
  var arrayOfLines = css.match(/[^\r\n]+/g);

  var bufferLineText = arrayOfLines[line];

  var endColumn;
  var trimmed = '';
  var len = bufferLineText.length;
  // debugger;
  var lineText = bufferLineText.replace(/^\s*/, '');
  var startColumn = len - lineText.length;
  var offset = startColumn;
  var endLine = bufferLine;
  var text = lineText;

  var i = 0;

  while (true) {
    i++;
    endColumn = lineText.indexOf('{');
    if (endColumn === -1) {
      text += lineText;
    }
    else {
      trimmed = lineText.replace(/\s*{?\s*$/, ''); // why is { optional here?
      endColumn = offset + trimmed.length;
      text += trimmed;
      break;
    }

    offset = 0;
    lineText = getLineText(++endLine);
    if (i === 10) {
      console.error('NOT A GOOD');
      return;
    }
    i++;
  }

  var range = makeNewRangeArray(bufferLine, startColumn, endLine, endColumn);

  console.error({
    range: range,
    text: text
  });

  return {
    untrimmedText: '',
    range: range,
    text: text
  };

}

function getLineTextGetter(css) {
  var arrayOfLines = css.match(/[^\r\n]+/g); // split on linebreaks
{'fraction_non_alphanumeric': 0.1553811659192825, 'fraction_numerical': 0.0026905829596412557, 'mean_word_length': 3.0702554744525545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6925883', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1481, 'n_words': 360}