Skip to content

Commit 66d88f9

Browse files
committed
overwrite notes
1 parent 0605fba commit 66d88f9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/engraving/editing/edit.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,8 +2042,10 @@ static Tie* createAndAddTie(Note* startNote, Note* endNote)
20422042

20432043
void Score::cmdAddTie(bool addToChord)
20442044
{
2045-
const std::vector<Note*> noteList = cmdTieNoteList(selection(), noteEntryMode());
2045+
std::vector<Note*> noteList = cmdTieNoteList(selection(), noteEntryMode());
20462046
std::vector<EngravingItem*> toSelect;
2047+
std::sort(noteList.begin(), noteList.end(), [](const Note* a, const Note* b) { return a->track() < b->track(); });
2048+
track_idx_t track = noteList[0]->chord()->track();
20472049

20482050
if (noteList.empty()) {
20492051
LOGD("no notes selected");
@@ -2088,7 +2090,10 @@ void Score::cmdAddTie(bool addToChord)
20882090
}
20892091

20902092
bool addFlag = lastAddedChord != nullptr;
2091-
2093+
if (c->track() != track) {
2094+
addFlag = false;
2095+
track = c->track();
2096+
}
20922097
// try to re-use existing note or chord
20932098
Note* n = nullptr;
20942099
if (addToChord && cr->isChord()) {
@@ -2099,8 +2104,6 @@ void Score::cmdAddTie(bool addToChord)
20992104
} else {
21002105
addFlag = true; // re-use chord
21012106
}
2102-
} else if (!noteEntryMode()) {
2103-
addFlag = false;
21042107
}
21052108

21062109
// if no note to re-use, create one
@@ -2189,7 +2192,7 @@ Tie* Score::cmdToggleTie()
21892192
const bool shouldTieListSelection = noteList.size() >= 2 && !singleTick;
21902193

21912194
if (singleTick /* i.e. all notes are in the same tick */ && !allHaveExistingNextNoteToTieTo) {
2192-
cmdAddTie(true);
2195+
cmdAddTie();
21932196
return nullptr;
21942197
}
21952198

0 commit comments

Comments
 (0)