<commit_before>import React from 'react';
import TextEditorComponent from 'common/components/text-editor';

class TextInputComponent extends React.Component {
  onInput(source) {
    this.props.reference.setValue(source);
  }
  setSelection(...args) {
    this.refs.editor.setSelection(...args);
  }
  select() {
    this.setSelection(0, Infinity);
  }
  focus() {
    this.refs.editor.focus();
  }
  onFocus() {
    if (this.props.selectAllOnFocus) {
      this.setSelection(0, Infinity);
    }
  }
  render() {
    var value = this.props.reference.getValue();

    var style = {
      overflow: 'hidden',

      // fix height change with overflow
      verticalAlign: 'bottom',
      whiteSpace: this.props.multiline ? void 0 : 'nowrap'
    };

    return <TextEditorComponent
      ref='editor'
      {...this.props}
      source={value}
      onFocus={this.onFocus.bind(this)}
      onChange={this.onInput.bind(this)}
      data-mouse-trap={false}
      style={Object.assign(style, this.props.style || {})}
      className={['input', this.props.className].join(' ') } />
  }
}
<commit_msg>do not update if source does not match<commit_after>import React from 'react';
import TextEditorComponent from 'common/components/text-editor';

class TextInputComponent extends React.Component {
  onInput(source) {
    this.props.reference.setValue(source);
  }
  setSelection(...args) {
    this.refs.editor.setSelection(...args);
  }
  select() {
    this.setSelection(0, Infinity);
  }
  focus() {
    this.refs.editor.focus();
  }
  onFocus() {
    if (this.props.selectAllOnFocus) {
      this.setSelection(0, Infinity);
    }
  }
  shouldComponentUpdate(props) {
    return props.reference.getValue() !== this.refs.editor.source;
  }
  render() {
    var value = this.props.reference.getValue();

    var style = {
      overflow: 'hidden',

      // fix height change with overflow
      verticalAlign: 'bottom',
      whiteSpace: this.props.multiline ? void 0 : 'nowrap'
    };

    return <TextEditorComponent
      ref='editor'
      {...this.props}
      source={value}
      onFocus={this.onFocus.bind(this)}
      onChange={this.onInput.bind(this)}
      data-mouse-trap={false}
      style={Object.assign(style, this.props.style || {})}
      className={['input', this.props.className].join(' ') } />
  }
}

{'fraction_non_alphanumeric': 0.15248380129589634, 'fraction_numerical': 0.002591792656587473, 'mean_word_length': 2.95221843003413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6639713', 'n_tokens_mistral': 735, 'n_tokens_neox': 723, 'n_words': 127}