diff --git a/src/importer/AlphaTexImporter.ts b/src/importer/AlphaTexImporter.ts index b9e23cd5c..b184045b3 100644 --- a/src/importer/AlphaTexImporter.ts +++ b/src/importer/AlphaTexImporter.ts @@ -1451,6 +1451,10 @@ export class AlphaTexImporter extends ScoreImporter { } } + private isNoteText(txt: string) { + return txt === 'x' || txt === '-' || txt === 'r'; + } + private note(beat: Beat): boolean { // fret.string let isDead: boolean = false; @@ -1823,7 +1827,7 @@ export class AlphaTexImporter extends ScoreImporter { let text: string = this._syData as string; this._sy = this.newSy(); let marker: string = ''; - if (this._sy === AlphaTexSymbols.String) { + if (this._sy === AlphaTexSymbols.String && !this.isNoteText((this._syData as string).toLowerCase())) { marker = text; text = this._syData as string; this._sy = this.newSy(); diff --git a/test/importer/AlphaTexImporter.test.ts b/test/importer/AlphaTexImporter.test.ts index 509c1f85d..d7ffd6692 100644 --- a/test/importer/AlphaTexImporter.test.ts +++ b/test/importer/AlphaTexImporter.test.ts @@ -912,4 +912,19 @@ describe('AlphaTexImporterTest', () => { // success } }) + + function runSectionNoteSymbolTest(noteSymbol:string) { + const score = parseTex(`1.3.4 * 4 | \\section Verse ${noteSymbol}.1 | 2.3.4*4`); + + expect(score.masterBars.length).toEqual(3); + expect(score.tracks[0].staves[0].bars[0].voices[0].beats.length).toEqual(4); + expect(score.masterBars[1].section!.text).toEqual('Verse'); + expect(score.tracks[0].staves[0].bars[1].voices[0].beats.length).toEqual(1); + } + + it('does-not-interpret-note-symbols-on-section', () => { + runSectionNoteSymbolTest('r'); + runSectionNoteSymbolTest('-'); + runSectionNoteSymbolTest('x'); + }) });