<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using OpenUtau.Core.Ustx;

namespace OpenUtau.Core.Editing {
    public interface NoteBatchEdit {
        string Name { get; }
        void Run(UProject project, UVoicePart part, List<UNote> selectedNotes, DocManager docManager);
    }

    public class AddTailDash : NoteBatchEdit {
        public string Name => "menu2.notes.addtaildash";
        public void Run(UProject project, UVoicePart part, List<UNote> selectedNotes, DocManager docManager) {
            List<UNote> toAdd = new List<UNote>();
            var notes = selectedNotes.Count > 0 ? selectedNotes : part.notes.ToList();
            foreach (var note in notes) {
                if (note.Next == null || note.Next.position > note.End + 120) {
                    toAdd.Add(project.CreateNote(note.tone, note.End, 120));
                }
            }
            if (toAdd.Count == 0) {
                return;
            }
            docManager.StartUndoGroup();
            foreach (var note in toAdd) {
                note.lyric = "-";
                docManager.ExecuteCmd(new AddNoteCommand(part, note));<commit_msg>Only add tail "-" once.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using OpenUtau.Core.Ustx;

namespace OpenUtau.Core.Editing {
    public interface NoteBatchEdit {
        string Name { get; }
        void Run(UProject project, UVoicePart part, List<UNote> selectedNotes, DocManager docManager);
    }

    public class AddTailDash : NoteBatchEdit {
        public string Name => "menu2.notes.addtaildash";
        public void Run(UProject project, UVoicePart part, List<UNote> selectedNotes, DocManager docManager) {
            List<UNote> toAdd = new List<UNote>();
            var notes = selectedNotes.Count > 0 ? selectedNotes : part.notes.ToList();
            foreach (var note in notes) {
                if (note.lyric != "-" && (note.Next == null || note.Next.position > note.End + 120)) {
                    toAdd.Add(project.CreateNote(note.tone, note.End, 120));
                }
            }
            if (toAdd.Count == 0) {
                return;
            }
            docManager.StartUndoGroup();
            foreach (var note in toAdd) {
                note.lyric = "-";
                docManager.ExecuteCmd(new AddNoteCommand(part, note));
{'fraction_non_alphanumeric': 0.10724759111855886, 'fraction_numerical': 0.00754084625052367, 'mean_word_length': 2.1297509829619923, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, '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': '227352', 'n_tokens_mistral': 695, 'n_tokens_neox': 660, 'n_words': 165}