<commit_before>function MatrixTable(id) {
    this.id = id

    // register click callback
    var mt = this;
    $(this.id).bind('mousedown', function(ev) {
        mt.clicked = true;
    });
    $(this.id).bind('mouseup', function(ev) {
        mt.clicked = false;
    });
    $(this.id).bind('mouseover', function(ev) {
        ev.stopPropagation();
        ev.preventDefault();

        var id = $(ev.target).attr('id');

        if (id.split('-')[0] == 'element' && mt.clicked) {
            var row = id.split('-')[1];
            var col = id.split('-')[2];

            // call user provided callback with row and col
            mt.on_click.call(null, row, col);
        }
    });

    return this;
}

MatrixTable.prototype = {
    reset: function(rows, cols) {
        console.info('Resetting MatrixTable');

        // Reset matrix content
        $(this.id).children().remove();
        
        this.rows = rows;
        this.cols = cols;

        // Init matrix
        for (var row = 0; row < rows; ++row) {
            var row_element = $('<tr></tr>').attr('id', 'row-'+row);
            row_element.appendTo($(this.id));
            for (var col = 0; col < cols; ++col) {
                td = $('<td></td>');
                div = $('<div></div>').attr('id', 'element-'+row+'-'+col);
                td.append(div).appendTo(row_element);
            }
        }

        this.on_reset.call();
    },
    set_rgb_color: function(row, col, r, g, b) {
        color = 'rgb('+r+','+g+','+b+')';
        this.image(row, col).css('background-color', color);
    },<commit_msg>Fixed bug related to pixel coloring. The start pixel of a dragging motion will now also get colored<commit_after>function MatrixTable(id) {
    this.id = id

    // register click callback
    var mt = this;
    function color_pixel(ev) {
        ev.stopPropagation();
        ev.preventDefault();

        var id = $(ev.target).attr('id');

        if (id.split('-')[0] == 'element' && mt.clicked) {
            var row = id.split('-')[1];
            var col = id.split('-')[2];

            // call user provided callback with row and col
            mt.on_click.call(null, row, col);
        }
    };

    $(this.id).bind('mousedown', function(ev) {
        mt.clicked = true;
        color_pixel(ev);
    });
    $(this.id).bind('mouseup', function(ev) {
        mt.clicked = false;
    });
    $(this.id).bind('mouseover', color_pixel);
    return this;
}

MatrixTable.prototype = {
    reset: function(rows, cols) {
        console.info('Resetting MatrixTable');

        // Reset matrix content
        $(this.id).children().remove();
        
        this.rows = rows;
        this.cols = cols;

        // Init matrix
        for (var row = 0; row < rows; ++row) {
            var row_element = $('<tr></tr>').attr('id', 'row-'+row);
            row_element.appendTo($(this.id));
            for (var col = 0; col < cols; ++col) {
                td = $('<td></td>');
                div = $('<div></div>').attr('id', 'element-'+row+'-'+col);
                td.append(div).appendTo(row_element);
            }
        }

        this.on_reset.call();
    },
    set_rgb_color: function(row, col, r, g, b) {
        color = 'rgb('+r+','+g+','+b+')';
        this.image(row, col).css('background-color', color);
    },
{'fraction_non_alphanumeric': 0.18980084490042246, 'fraction_numerical': 0.0030175015087507543, 'mean_word_length': 1.8776041666666667, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '5474377', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1055, 'n_words': 222}