Forwarded: part of Origin PR by Jojo-Schmitz Origin: https://github.com/musescore/MuseScore/pull/9000 Author: juerg-mueller Description: Fix #326259: Keep kar format on import i.e. don't remove slashes from lyrics on MIDI import . Those slashes are apparently used by Karaoke software to show one phrase (delimited by those slashes) at a time. They don't really harm in MuseScore, but are needed/wanted for MIDI export including (which MuseScore can't do currently, but an external tool can, see https://github.com/juerg-mueller/InsertLyrics) and the lyrics most probably need to get amended anyway (to add lyrics dashes and melismas) --- a/mscore/importmidi/importmidi_lyrics.cpp +++ b/mscore/importmidi/importmidi_lyrics.cpp @@ -159,25 +159,6 @@ void addTitleToScore(Score *score, const measure->add(text); } -// remove slashes in kar format - -QString removeSlashes(const QString &text) - { - QString newText = text; - newText = newText.replace("/", ""); - newText = newText.replace("\\", ""); - return newText; - } - -std::string removeSlashes(const std::string &text) - { - std::string str = text; - char chars[] = "/\\"; - for (unsigned int i = 0; i != strlen(chars); ++i) - str.erase(std::remove(str.begin(), str.end(), chars[i]), str.end()); - return str; - } - void addTitleIfAny(const std::multimap &lyricTrack, Score *score) { int textCounter = 0; @@ -214,7 +195,7 @@ void addLyricsToScore( QString text = MidiCharset::convertToCharset(it->second); if (originalTime != ReducedFraction(0, 1) || !isTitlePrefix(text)) { // not title - score->addLyrics(quantizedTime.fraction(), staffAddTo->idx(), removeSlashes(text).toHtmlEscaped()); + score->addLyrics(quantizedTime.fraction(), staffAddTo->idx(), text.toHtmlEscaped()); } } } @@ -307,7 +288,7 @@ QList makeLyricsListForUI() std::string lyricText; for (const auto &lyric: trackLyric) { - const auto &text = removeSlashes(lyric.second); + const auto &text = lyric.second; if (isMetaText(text)) continue; if (!lyricText.empty())