From 14c27b541a7532cd4af3f212031716158148a296 Mon Sep 17 00:00:00 2001 From: Hasinjato Date: Mon, 1 Jun 2026 09:10:37 +0300 Subject: [PATCH] Update template source when new marker or notes modified --- .../kotlin/mg/dot/feufaro/solfa/Solfa.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt index 5793e40..b9e2823 100644 --- a/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt +++ b/composeApp/src/commonMain/kotlin/mg/dot/feufaro/solfa/Solfa.kt @@ -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")