Skip to content

Commit cd5a17a

Browse files
committed
move block outside loop
1 parent 03a3056 commit cd5a17a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/engraving/editing/edit.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,31 +2168,34 @@ Tie* Score::cmdToggleTie()
21682168
bool canAddTies = false;
21692169
const size_t notes = noteList.size();
21702170
std::vector<Note*> tieNoteList(notes);
2171+
Note* tieNote = nullptr;
2172+
Note* n = nullptr;
21712173

21722174
bool sameChord = std::all_of(noteList.begin(), noteList.end(), [&](const Note* n) { return n->chord() == noteList[0]->chord(); });
21732175
const bool shouldTieListSelection = !sameChord;
21742176

21752177
for (size_t i = 0; i < notes; ++i) {
2176-
Note* n = noteList[i];
2178+
n = noteList[i];
21772179
if (n->tieFor()) {
21782180
tieNoteList[i] = nullptr;
21792181
} else {
2180-
Note* tieNote = searchTieNote(n);
2182+
tieNote = searchTieNote(n);
21812183
tieNoteList[i] = tieNote;
21822184
if (tieNote) {
21832185
canAddTies = true;
21842186
}
2185-
if (!tieNote && selection().isList() && sameChord) {
2186-
cmdAddTie();
2187-
if (notes >= 2) {
2188-
Chord* c = n->chord()->next();
2189-
for (Note* cn : c->notes()) {
2190-
score()->select(cn, SelectType::ADD);
2191-
}
2192-
}
2193-
return nullptr;
2187+
}
2188+
}
2189+
2190+
if (!tieNote && selection().isList() && sameChord) {
2191+
cmdAddTie();
2192+
if (notes >= 2) {
2193+
Chord* c = n->chord()->next();
2194+
for (Note* cn : c->notes()) {
2195+
score()->select(cn, SelectType::ADD);
21942196
}
21952197
}
2198+
return nullptr;
21962199
}
21972200

21982201
const TranslatableString actionName = canAddTies

0 commit comments

Comments
 (0)