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

fix #19480 last tied note accidentals #19482

Merged
merged 2 commits into from Oct 2, 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
8 changes: 6 additions & 2 deletions src/engraving/dom/cmd.cpp
Expand Up @@ -2032,8 +2032,12 @@ static void changeAccidental2(Note* n, int pitch, int tpc)
}
}
} else {
for (Note* nn = n; nn && nn->tieFor(); nn = nn->tieFor()->endNote()) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
Note* nn = n;
while (nn && nn->tieFor()) {
nn = nn->tieFor()->endNote();
if (nn) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}
}
Comment on lines +2035 to 2041
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not:

Suggested change
Note* nn = n;
while (nn && nn->tieFor()) {
nn = nn->tieFor()->endNote();
if (nn) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}
}
for (Note* nn = n; nn; nn = nn->tieFor() ? nn->tieFor()->endNote() : nullptr) {
score->undo(new ChangePitch(nn, pitch, tpc1, tpc2));
}

Copy link
Contributor Author

@sammik sammik Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not:

I think

  1. becouse endNote() may by nullptr, so we would need nullcheck anyway
  2. because we dont need to change n (which is tie start note), but need to start with next tied note

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. becouse endNote() may by nullptr, so we would need nullcheck anyway

That would be done by the ; nn;.

Anyway, I'll stop nitpicking about things like this :)

}
}
Expand Down