Fixup! editing notes for lowercase template
This commit is contained in:
parent
65c56db655
commit
2d9df62a50
2 changed files with 6 additions and 3 deletions
|
|
@ -361,7 +361,7 @@ fun validateMusicalInput(input: String, template: String): Boolean {
|
||||||
val regexPattern = buildString {
|
val regexPattern = buildString {
|
||||||
cleanTemplate.forEachIndexed { index, char ->
|
cleanTemplate.forEachIndexed { index, char ->
|
||||||
when (char) {
|
when (char) {
|
||||||
in 'A'..'Y' -> {
|
in 'A'..'Y', in 'a'..'y' -> {
|
||||||
append("(?:―|di|ri|fi|si|ta|[drmfslt])[¹²³₁₂₃]*")
|
append("(?:―|di|ri|fi|si|ta|[drmfslt])[¹²³₁₂₃]*")
|
||||||
}
|
}
|
||||||
'z' -> {
|
'z' -> {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.ArrowBackIos
|
||||||
import androidx.compose.material.icons.automirrored.filled.Undo
|
import androidx.compose.material.icons.automirrored.filled.Undo
|
||||||
import androidx.compose.material.icons.filled.Build
|
import androidx.compose.material.icons.filled.Build
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
|
|
@ -1236,7 +1237,9 @@ fun autoFixNote(rawNote: String, template: String): String {
|
||||||
val actualNotes = noteRegex.findAll(rawNote).map { it.value }.toList()
|
val actualNotes = noteRegex.findAll(rawNote).map { it.value }.toList()
|
||||||
|
|
||||||
if (rawNote.contains("•") || rawNote.contains("―") || rawNote.contains(",")) {
|
if (rawNote.contains("•") || rawNote.contains("―") || rawNote.contains(",")) {
|
||||||
val templateNotesCount = template.count { it in 'A'..'Y' }
|
val templateNotesCount = template.count { c ->
|
||||||
|
c in 'A'..'Y' || c in 'a'..'y'
|
||||||
|
}
|
||||||
if (actualNotes.size >= templateNotesCount) return rawNote
|
if (actualNotes.size >= templateNotesCount) return rawNote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1246,7 +1249,7 @@ fun autoFixNote(rawNote: String, template: String): String {
|
||||||
for (i in template.indices) {
|
for (i in template.indices) {
|
||||||
val char = template[i]
|
val char = template[i]
|
||||||
when {
|
when {
|
||||||
char in 'A'..'Y' -> {
|
(char in 'A'..'Y' || char in 'a'..'y') -> {
|
||||||
if (noteIdx < actualNotes.size) {
|
if (noteIdx < actualNotes.size) {
|
||||||
result.append(actualNotes[noteIdx])
|
result.append(actualNotes[noteIdx])
|
||||||
noteIdx++
|
noteIdx++
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue