Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #15897: Entering Roman numeral analysis crashes when using screen reader #16074

Merged
merged 1 commit into from Jan 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/engraving/libmscore/harmony.cpp
Expand Up @@ -2104,11 +2104,14 @@ String Harmony::generateScreenReaderInfo() const
{ u"i", u"1" },
};
static std::vector<std::pair<String, String> > symbolReplacements {
{ u"b", u"♭" },
{ u"h", u"♮" },
{ u"#", u"♯" },
{ u"bb", u"𝄫" },
{ u"##", u"𝄪" },
{ u"h", u"♮" },
{ u"\\♮", u"h" }, // \h should be h, so need to correct replacing in the previous step
{ u"#", u"♯" },
{ u"\\♯", u"#" }, // \# should be #, so need to correct replacing in the previous step
{ u"b", u"♭" },
{ u"\\♭", u"b" }, // \b should be b, so need to correct replacing in the previous step
// TODO: use SMuFL glyphs and translate
//{ "o", ""},
//{ "0", ""},
Expand All @@ -2119,10 +2122,7 @@ String Harmony::generateScreenReaderInfo() const
aux.replace(r.first, r.second);
}
for (auto const& r : symbolReplacements) {
// only replace when not preceded by backslash
String s = u"(?<!\\\\)" + r.first;
std::regex re(s.toStdString());
aux.replace(re, r.second);
aux.replace(r.first, r.second);
}
// construct string one character at a time
for (size_t i = 0; i < aux.size(); ++i) {
Expand Down