<commit_before>define(function(require, exports, module) {
    var session = require("zed/session");

    return function(options, callback) {
        var selected_lines = [];
        var chopped = false;

        session.getSelectionText(options.path, function(ignored, text) {
            if (text.slice(text.length - 1) == "\n") {
                chopped = true;
                text = text.substring(0, text.length - 1);
            }

            selected_lines = text.split("\n").sort();

            session.getSelectionRange(options.path, function(ignored, range) {
                if (chopped) {
                    selected_lines.push("");
                }
                session.replaceRange(
                    options.path, range, selected_lines.join("\n"), callback);
            });
        });
    };
});<commit_msg>Clean up sort_selection.js<commit_after>var session = require("zed/session");

module.exports = function(options, callback) {
    var selected_lines = [];
    var chopped = false;

    session.getSelectionText(options.path, function(ignored, text) {
        if (text.slice(text.length - 1) == "\n") {
            chopped = true;
            text = text.substring(0, text.length - 1);
        }

        selected_lines = text.split("\n").sort();

        session.getSelectionRange(options.path, function(ignored, range) {
            if (chopped) {
                selected_lines.push("");
            }
            session.replaceRange(
            options.path, range, selected_lines.join("\n"), callback);
        });
    });
};
{'fraction_non_alphanumeric': 0.13929712460063898, 'fraction_numerical': 0.0038338658146964857, 'mean_word_length': 1.9053803339517625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3738348', 'n_tokens_mistral': 431, 'n_tokens_neox': 413, 'n_words': 79}