Update template source when new marker or notes modified

This commit is contained in:
Hasinjato 2026-06-01 09:10:37 +03:00
parent 6b8ce0cecf
commit 14c27b541a

View file

@ -781,8 +781,20 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
): String {
/* On ne modifie pas le template tant que les notes ne sont pas modifiées
* Et tant qu'une marker est ajouter */
if (newMarkerValue.isEmpty()) {
println("Aucune modification détectée (marqueur vide), on retourne le template original.")
val notesByVoice = editState.notesByVoice
val originalNotes = editState.originalNotes
var anyNoteModified = false
for (voiceNum in 0..3) {
val newNot = notesByVoice[voiceNum] ?: ""
val oldNot = originalNotes[voiceNum] ?: ""
if (newNot != oldNot) {
anyNoteModified = true
break
}
}
if (!anyNoteModified && newMarkerValue.isEmpty()) {
println("Aucune modification détectée, on retourne le template original.")
return templateLine
}
val isT0 = templateLine.startsWith("T0")