<commit_before>iD.actions.RemoveWayNode = function(wayId, nodeId) {
    return function(graph) {
        var way = graph.entity(wayId),
            nodes = _.without(way.nodes, nodeId);
        return graph.replace(way.update({nodes: nodes}), 'removed from a road');
    };
};<commit_msg>Reclose ways if you delete the repeated node. Fixes #221<commit_after>iD.actions.RemoveWayNode = function(wayId, nodeId) {
    return function(graph) {
        var way = graph.entity(wayId), nodes;
        // If this is the connecting node in a closed area
        if (way.nodes.length > 1 &&
            _.indexOf(way.nodes, nodeId) === 0 &&
            _.lastIndexOf(way.nodes, nodeId) === way.nodes.length - 1) {
            // Remove the node
            nodes = _.without(way.nodes, nodeId);
            // And reclose the way on the new first node.
            nodes.push(nodes[0]);
        } else {
            nodes = _.without(way.nodes, nodeId);
        }
        return graph.replace(way.update({nodes: nodes}), 'removed from a road');
    };
};
{'fraction_non_alphanumeric': 0.1331417624521073, 'fraction_numerical': 0.006704980842911878, 'mean_word_length': 2.265625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '950005', 'n_tokens_mistral': 311, 'n_tokens_neox': 305, 'n_words': 83}