<commit_before>import React, { Component } from 'react';

class Cursor extends Component {
    constructor() {
        super();
        this.state = {
            opacity: 1
        };
    }

    startBlinking() {
        this.interval = setInterval(() => {
            if (this.state.opacity === 1) {
                this.setState({ opacity: 0 });
            } else {
                this.setState({ opacity: 1 });
            }
        }, 500);
    }

    componentDidMount() {
        this.startBlinking();
    }

    componentWillUnmount() {
        clearInterval(this.interval);
    }

    componentWillUpdate(nextProps, nextState) {
        if (nextProps.column !== this.props.column && nextProps.line !== this.props.line) {
            clearInterval(this.interval);
            this.startBlinking();
            this.setState({ opacity: 1 });
        }
    }

    render() {
        let cursorWidth = 2;
        let gutterWidth = 45;
        let { charWidth, charHeight } = this.props;
        let style = {
            position: 'absolute',
            left: this.props.column * charWidth - 1 + gutterWidth,
            top: (this.props.line - 1) * charHeight,
            width: cursorWidth,
            height: charHeight,
            background: 'black',
            opacity: this.props.visible ? this.state.opacity : 0
        };

        return <div style={style}></div>;
    }
}

Cursor.defaultProps = {
    visible: true
};

Cursor.propTypes = {
    visible: React.PropTypes.bool,
    charWidth: React.PropTypes.number,
    charHeight: React.PropTypes.number
};

export default Cursor;
<commit_msg>prevent cursor from blinking while moving it<commit_after>import React, { Component } from 'react';

class Cursor extends Component {
    constructor() {
        super();
        this.state = {
            opacity: 1
        };
    }

    startBlinking() {
        this.interval = setInterval(() => {
            if (this.state.opacity === 1) {
                this.setState({ opacity: 0 });
            } else {
                this.setState({ opacity: 1 });
            }
        }, 500);
    }

    componentDidMount() {
        this.startBlinking();
    }

    componentWillUnmount() {
        clearInterval(this.interval);
    }

    componentWillUpdate(nextProps, nextState) {
        if (nextProps.column !== this.props.column || nextProps.line !== this.props.line) {
            clearInterval(this.interval);
            this.startBlinking();
            this.setState({ opacity: 1 });
        }
    }

    render() {
        let cursorWidth = 2;
        let gutterWidth = 45;
        let { charWidth, charHeight } = this.props;
        let style = {
            position: 'absolute',
            left: this.props.column * charWidth - 1 + gutterWidth,
            top: (this.props.line - 1) * charHeight,
            width: cursorWidth,
            height: charHeight,
            background: 'black',
            opacity: this.props.visible ? this.state.opacity : 0
        };

        return <div style={style}></div>;
    }
}

Cursor.defaultProps = {
    visible: true
};

Cursor.propTypes = {
    visible: React.PropTypes.bool,
    charWidth: React.PropTypes.number,
    charHeight: React.PropTypes.number
};

export default Cursor;

{'fraction_non_alphanumeric': 0.12457809143909175, 'fraction_numerical': 0.00859159251304081, 'mean_word_length': 1.7839453458582408, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '1819725', 'n_tokens_mistral': 942, 'n_tokens_neox': 897, 'n_words': 194}