<commit_before>// Resizable textareas based on http://www.impressivewebs.com/textarea-auto-resize/
/*global document:false, $:false */
$(function() {
  var txt = $('textarea');
  var hiddenDiv = $(document.createElement('div'));
  var content = null;

  txt.addClass('txtstuff');
  hiddenDiv.addClass('hiddendiv common');
  resetResizeTextarea = function () {
    txt.each(function() {
      // default/initial heights for all textareas so
      // that resizing doesn't get shorter than this
      var textarea = $(this);
      textarea.css('height', "auto");
      textarea.css('min-height', "");
      textarea.removeAttr('min-height');
      textarea.css('min-height', textarea.outerHeight());
      textarea.attr("data-height", textarea.outerHeight());
    });
  }
  resetResizeTextarea()
  $('body').append(hiddenDiv);

  resizeTextarea = function (textInput) {
    content = textInput.val();

    content = content.replace(/\n/g, '<br>');
    hiddenDiv.html(content + '<br class="lbr">');

    if (hiddenDiv.height() >= textInput.attr("data-height")) {
      // resize when there's more text than the text container
      textInput.css("height", hiddenDiv.height()+1);
    } else if (content == "") {
      // resize when no text
      textInput.css("height", textInput.attr("data-height"));
    }
  }

  txt.each(function() {
    resizeTextarea($(this));
  });

  txt.on('keyup', function () {
    resizeTextarea($(this));
  });

  txt.on('mouseup', function () {
    // resize the text container with the textarea resize handle
    var textarea = $(this);
    textarea.css("height", textarea.height());
    textarea.attr("data-height", textarea.height())
  });
});
<commit_msg>Do not resize when using tab key<commit_after>// Resizable textareas based on http://www.impressivewebs.com/textarea-auto-resize/
/*global document:false, $:false */
$(function() {
  var txt = $('textarea');
  var hiddenDiv = $(document.createElement('div'));
  var content = null;

  txt.addClass('txtstuff');
  hiddenDiv.addClass('hiddendiv common');
  resetResizeTextarea = function () {
    txt.each(function() {
      // default/initial heights for all textareas so
      // that resizing doesn't get shorter than this
      var textarea = $(this);
      textarea.css('height', "auto");
      textarea.css('min-height', "");
      textarea.removeAttr('min-height');
      textarea.css('min-height', textarea.outerHeight());
      textarea.attr("data-height", textarea.outerHeight());
    });
  }
  resetResizeTextarea()
  $('body').append(hiddenDiv);

  resizeTextarea = function (textInput) {
    content = textInput.val();

    content = content.replace(/\n/g, '<br>');
    hiddenDiv.html(content + '<br class="lbr">');

    if (hiddenDiv.height() >= textInput.attr("data-height")) {
      // resize when there's more text than the text container
      textInput.css("height", hiddenDiv.height()+1);
    } else if (content == "") {
      // resize when no text
      textInput.css("height", textInput.attr("data-height"));
    }
  }

  txt.each(function() {
    resizeTextarea($(this));
  });

  txt.on('keyup', function (e) {
    if (e.keyCode != 9) {
      resizeTextarea($(this));
    }
  });

  txt.on('mouseup', function () {
    // resize the text container with the textarea resize handle
    var textarea = $(this);
    textarea.css("height", textarea.height());
    textarea.attr("data-height", textarea.height())
  });
});

{'fraction_non_alphanumeric': 0.17717454757734968, 'fraction_numerical': 0.0008756567425569177, 'mean_word_length': 3.3823529411764706, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '251602', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1029, 'n_words': 226}