apply to 2.3.2
[alioth/musescore.git] / debian / patches / upstream / 5507.patch
1 Origin: backport, commit:431961b43657eb8463f358f53bdfdd802a8bde4d
2 Author: Howard-C <howardc@pku.edu.cn>
3 Description: fix #292648: make courtesy accidentals stay if notes are
4  changed using Ctrl+Up/Down
5
6 --- a/libmscore/cmd.cpp
7 +++ b/libmscore/cmd.cpp
8 @@ -1354,16 +1354,21 @@ void Score::upDown(bool up, UpDownMode m
9  
10              if ((oNote->pitch() != newPitch) || (oNote->tpc1() != newTpc1) || oNote->tpc2() != newTpc2) {
11                    // remove accidental if present to make sure
12 -                  // user added accidentals are removed here.
13 -                  if (oNote->links()) {
14 -                        for (ScoreElement* e : *oNote->links()) {
15 -                              Note* ln = static_cast<Note*>(e);
16 -                              if (ln->accidental())
17 -                                    undoRemoveElement(ln->accidental());
18 +                  // user added accidentals are removed here
19 +                  // unless it's an octave change
20 +                  // in this case courtesy accidentals are preserved
21 +                  // because they're now harder to be re-entered due to the revised note-input workflow
22 +                  if (mode != UpDownMode::OCTAVE) {
23 +                        if (oNote->links()) {
24 +                              for (ScoreElement* e : *oNote->links()) {
25 +                                    Note* ln = static_cast<Note*>(e);
26 +                                    if (ln->accidental())
27 +                                          undoRemoveElement(ln->accidental());
28 +                                    }
29                                }
30 +                        else if (oNote->accidental())
31 +                              undoRemoveElement(oNote->accidental());
32                          }
33 -                  else if (oNote->accidental())
34 -                        undoRemoveElement(oNote->accidental());
35                    undoChangePitch(oNote, newPitch, newTpc1, newTpc2);
36                    }
37