Fix! keep block template when attaching on hairpin marker
This commit is contained in:
parent
bd936fe3b8
commit
d67d54db24
1 changed files with 20 additions and 13 deletions
|
|
@ -899,11 +899,13 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
return finalResult
|
return finalResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
when {
|
||||||
/* Set Pending Hairpin */
|
initMarkerValue.contains("\${>}") || initMarkerValue.contains("\${<}") -> {
|
||||||
when (initMarkerValue) {
|
sharedScreenModel.setPendingHairPin(true, targetPointer)
|
||||||
"\${>}", "\${<}" -> sharedScreenModel.setPendingHairPin(true, targetPointer)
|
}
|
||||||
"\${=}" -> sharedScreenModel.setPendingHairPin(false)
|
initMarkerValue.contains("\${=}") -> {
|
||||||
|
sharedScreenModel.setPendingHairPin(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val notesByVoice = editState.notesByVoice
|
val notesByVoice = editState.notesByVoice
|
||||||
|
|
@ -1014,15 +1016,20 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
if (oldHadOpen && !newHasOpen) {
|
if (oldHadOpen && !newHasOpen) {
|
||||||
dropNextCloseParenthesis = true
|
dropNextCloseParenthesis = true
|
||||||
}
|
}
|
||||||
var adjustedTemplate = newTemplate
|
|
||||||
|
val bodyContent = if (newTemplate.isNotEmpty() && anyNoteModified) {
|
||||||
|
var adjusted = newTemplate
|
||||||
if (newTemplate.endsWith(")")) {
|
if (newTemplate.endsWith(")")) {
|
||||||
val remainingText = body.substring(i).trimStart { it in separators }
|
val remainingText = body.substring(i).trimStart { it in separators }
|
||||||
if (remainingText.startsWith(")")) {
|
if (remainingText.startsWith(")")) {
|
||||||
adjustedTemplate = newTemplate.dropLast(1)
|
adjusted = newTemplate.dropLast(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
adjusted
|
||||||
val rawProcessed = separat + leadingCloseParentheses + newMarkerValue + adjustedTemplate
|
} else {
|
||||||
|
oldCleaned
|
||||||
|
}
|
||||||
|
val rawProcessed = separat + leadingCloseParentheses + newMarkerValue + bodyContent
|
||||||
|
|
||||||
var cleanedProcessed = rawProcessed
|
var cleanedProcessed = rawProcessed
|
||||||
while (cleanedProcessed.contains("((") || cleanedProcessed.contains("))")) {
|
while (cleanedProcessed.contains("((") || cleanedProcessed.contains("))")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue