@@ -2044,6 +2044,7 @@ void Score::cmdAddTie(bool addToChord)
20442044{
20452045 const std::vector<Note*> noteList = cmdTieNoteList (selection (), noteEntryMode ());
20462046 std::vector<EngravingItem*> toSelect;
2047+
20472048 if (noteList.empty ()) {
20482049 LOGD (" no notes selected" );
20492050 return ;
@@ -2072,6 +2073,7 @@ void Score::cmdAddTie(bool addToChord)
20722073 cr = toChord (c->explicitParent ());
20732074 addToChord = true ;
20742075 } else {
2076+ m_is.setTrack (note->chord ()->track ());
20752077 m_is.setSegment (note->chord ()->segment ());
20762078 m_is.moveToNextInputPos ();
20772079 m_is.setLastSegment (m_is.segment ());
@@ -2097,6 +2099,8 @@ void Score::cmdAddTie(bool addToChord)
20972099 } else {
20982100 addFlag = true ; // re-use chord
20992101 }
2102+ } else if (!noteEntryMode ()) {
2103+ addFlag = false ;
21002104 }
21012105
21022106 // if no note to re-use, create one
@@ -2161,13 +2165,13 @@ Tie* Score::cmdToggleTie()
21612165 }
21622166
21632167 std::vector<Note*> tieNoteList (noteList.size ());
2164- Chord* chord = noteList. front ()-> chord () ;
2168+ bool singleTick = true ;
21652169 bool someHaveExistingNextNoteToTieTo = false ;
2166-
2170+ bool allHaveExistingNextNoteToTieTo = true ;
21672171 for (size_t i = 0 ; i < noteList.size (); ++i) {
21682172 Note* n = noteList[i];
2169- if (chord && n->chord () != chord ) {
2170- chord = nullptr ;
2173+ if (n->chord ()-> tick () != noteList. front ()-> tick () ) {
2174+ singleTick = false ;
21712175 }
21722176 if (n->tieFor ()) {
21732177 tieNoteList[i] = nullptr ;
@@ -2176,13 +2180,16 @@ Tie* Score::cmdToggleTie()
21762180 tieNoteList[i] = tieNote;
21772181 if (tieNote) {
21782182 someHaveExistingNextNoteToTieTo = true ;
2183+ } else {
2184+ allHaveExistingNextNoteToTieTo = false ;
21792185 }
2186+
21802187 }
21812188 }
21822189
2183- const bool shouldTieListSelection = noteList.size () >= 2 && !chord ;
2190+ const bool shouldTieListSelection = noteList.size () >= 2 && !singleTick ;
21842191
2185- if (chord ) { /* i.e. all notes are in the same chord */
2192+ if (singleTick && !allHaveExistingNextNoteToTieTo ) { /* i.e. all notes are in the same tick */
21862193 cmdAddTie (true );
21872194 return nullptr ;
21882195 }
0 commit comments