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
|
||||
}
|
||||
|
||||
|
||||
/* Set Pending Hairpin */
|
||||
when (initMarkerValue) {
|
||||
"\${>}", "\${<}" -> sharedScreenModel.setPendingHairPin(true, targetPointer)
|
||||
"\${=}" -> sharedScreenModel.setPendingHairPin(false)
|
||||
when {
|
||||
initMarkerValue.contains("\${>}") || initMarkerValue.contains("\${<}") -> {
|
||||
sharedScreenModel.setPendingHairPin(true, targetPointer)
|
||||
}
|
||||
initMarkerValue.contains("\${=}") -> {
|
||||
sharedScreenModel.setPendingHairPin(false)
|
||||
}
|
||||
}
|
||||
|
||||
val notesByVoice = editState.notesByVoice
|
||||
|
|
@ -1014,15 +1016,20 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
|||
if (oldHadOpen && !newHasOpen) {
|
||||
dropNextCloseParenthesis = true
|
||||
}
|
||||
var adjustedTemplate = newTemplate
|
||||
if (newTemplate.endsWith(")")) {
|
||||
val remainingText = body.substring(i).trimStart { it in separators }
|
||||
if (remainingText.startsWith(")")) {
|
||||
adjustedTemplate = newTemplate.dropLast(1)
|
||||
}
|
||||
}
|
||||
|
||||
val rawProcessed = separat + leadingCloseParentheses + newMarkerValue + adjustedTemplate
|
||||
val bodyContent = if (newTemplate.isNotEmpty() && anyNoteModified) {
|
||||
var adjusted = newTemplate
|
||||
if (newTemplate.endsWith(")")) {
|
||||
val remainingText = body.substring(i).trimStart { it in separators }
|
||||
if (remainingText.startsWith(")")) {
|
||||
adjusted = newTemplate.dropLast(1)
|
||||
}
|
||||
}
|
||||
adjusted
|
||||
} else {
|
||||
oldCleaned
|
||||
}
|
||||
val rawProcessed = separat + leadingCloseParentheses + newMarkerValue + bodyContent
|
||||
|
||||
var cleanedProcessed = rawProcessed
|
||||
while (cleanedProcessed.contains("((") || cleanedProcessed.contains("))")) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue