<commit_before>
define([
    'rangy',
    'rangy-text'
], function(
    rangy,
    rangyText
) {

    return {
        expandRangeByWords: function(range, numberWords, splitBeforeAfterOutput) {
            if (!rangy.initialized) rangy.init();

            var e = rangy.createRange();
            e.setStart(range.startContainer, range.startOffset);
            e.setEnd(range.endContainer, range.endOffset);

            // Move range start to include n more of words
            e.moveStart('word', -numberWords);

            // Move range end to include n more words
            e.moveEnd('word', numberWords);

            // Calculate what we just included and send that back
            if (splitBeforeAfterOutput) {
                var output = rangy.createRange();
                output.setStart(e.startContainer, e.startOffset);
                output.setEnd(range.startContainer, range.startOffset);
                splitBeforeAfterOutput.before = output.text();
<commit_msg>Fix issue where first selection in detail pane after refresh would not be possible<commit_after>
define([
    'rangy',
    'rangy-text'
], function(
    rangy,
    rangyText
) {

    if (!rangy.initialized) rangy.init();

    return {
        expandRangeByWords: function(range, numberWords, splitBeforeAfterOutput) {

            var e = rangy.createRange();
            e.setStart(range.startContainer, range.startOffset);
            e.setEnd(range.endContainer, range.endOffset);

            // Move range start to include n more of words
            e.moveStart('word', -numberWords);

            // Move range end to include n more words
            e.moveEnd('word', numberWords);

            // Calculate what we just included and send that back
            if (splitBeforeAfterOutput) {
                var output = rangy.createRange();
                output.setStart(e.startContainer, e.startOffset);
                output.setEnd(range.startContainer, range.startOffset);
                splitBeforeAfterOutput.before = output.text();

{'fraction_non_alphanumeric': 0.09813542688910697, 'fraction_numerical': 0.0, 'mean_word_length': 2.151468315301391, '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': '6073371', 'n_tokens_mistral': 558, 'n_tokens_neox': 523, 'n_words': 139}