<commit_before>$(document).on('turbolinks:load', function () {
    // ruby part adds the relative_url_root, if it is set.
    var ACE_FILES_PATH = '<%= (defined?  Rails.application.config.relative_url_root) &&  Rails.application.config.relative_url_root != nil &&  Rails.application.config.relative_url_root != "" ?  Rails.application.config.relative_url_root : "" %>' + '/assets/ace/';
    var THEME = 'ace/theme/textmate';

    var TAB_KEY_CODE = 9;

    var execution_environments;
    var file_types;


    var configureEditors = function () {
        _.each(['modePath', 'themePath', 'workerPath'], function (attribute) {
            ace.config.set(attribute, ACE_FILES_PATH);
        });
    };

    var initializeEditor = function (index, element) {
        var editor = ace.edit(element);

        var document = editor.getSession().getDocument();
        // insert pre-existing code into editor. we have to use insertLines, otherwise the deltas are not properly added
        var file_id = $(element).data('file-id');
        var content = $('.editor-content[data-file-id=' + file_id + ']');

        document.insertLines(0, content.text().split(/\n/));
        // remove last (empty) that is there by default line
        document.removeLines(document.getLength() - 1, document.getLength() - 1);<commit_msg>Prevent last line from being deleted when editing exercises<commit_after>$(document).on('turbolinks:load', function () {
    // ruby part adds the relative_url_root, if it is set.
    var ACE_FILES_PATH = '<%= (defined?  Rails.application.config.relative_url_root) &&  Rails.application.config.relative_url_root != nil &&  Rails.application.config.relative_url_root != "" ?  Rails.application.config.relative_url_root : "" %>' + '/assets/ace/';
    var THEME = 'ace/theme/textmate';

    var TAB_KEY_CODE = 9;

    var execution_environments;
    var file_types;


    var configureEditors = function () {
        _.each(['modePath', 'themePath', 'workerPath'], function (attribute) {
            ace.config.set(attribute, ACE_FILES_PATH);
        });
    };

    var initializeEditor = function (index, element) {
        var editor = ace.edit(element);

        var document = editor.getSession().getDocument();
        // insert pre-existing code into editor. we have to use insertLines, otherwise the deltas are not properly added
        var file_id = $(element).data('file-id');
        var content = $('.editor-content[data-file-id=' + file_id + ']');

        document.insertLines(0, content.text().split(/\n/));
        // remove last (empty) that is there by default; disabled due to missing last line
        // document.removeLines(document.getLength() - 1, document.getLength() - 1);
{'fraction_non_alphanumeric': 0.13896056026538886, 'fraction_numerical': 0.002948765204570586, 'mean_word_length': 3.2077519379844963, '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': '3298082', 'n_tokens_mistral': 811, 'n_tokens_neox': 774, 'n_words': 192}